
rr.addHandler(document,'mousedown',function(e){
if(!window.escape)return;
e=e||window.event;
var tg=e.target||e.srcElement,d,rid=window._request_id;
while(tg){
if(tg.id){
document.cookie='rmclick'+"="+escape(tg.id)+(rid?':'+rid:'');
return;
};
tg=tg.parentNode;
};
},true);
document.documentElement.id='onscript';
if($is.Opera<8&&!$is.j2me)
document.write('<link rel="stylesheet" type="text/css" href="'+(window._static_host||'')+'/css/opera7.css" media="all">');
new function(){
var rh=($is.debug?'':'.pack')+'.js',sh=window._static_host||'';
rr.include.add({
'rr.shortcut':sh+'/js/rr_shortcut'+rh,
'rr.xhrloader':sh+'/js/rr_xhrloader'+rh,
'rr.fx':sh+'/js/rr_fx'+rh,
'lib.moveobj':sh+'/js/lib_moveobj.js',
'lib.slaidshow':sh+'/js/lib_slaidshow.js',
'lib.popupVideo':sh+'/js/lib_popupvideo.js',
'raWindow':sh+'/js/win_023a'+rh,
'vkeyboard':sh+'/js/vkey2s'+rh,
'tooltip':sh+'/js/tooltip'+rh,
'sidebar':sh+'/js/sidebar'+rh,
'selectlist':sh+'/js/selectlist'+rh,
'composeTools':sh+'/js/compose_tools'+rh,
'winContacts':sh+'/js/contacts'+rh,
'composeInitREdit':sh+'/js/compose_richedit'+rh,
'rmc':sh+'/js/rmc.js',
'rmc_compose':sh+'/js/rmc_compose.js',
'ramspell':sh+'/js/ramspell.js',
'fastSend':sh+'/js/message_fsend.'+($is.debug?'src.':'')+'js',
'storage':'/js/storage.js'
});
rr.include.load('rr.xhrloader rr.fx rr.shortcut');
rr.init(function(){
rr.include.load('tooltip');
});
};
rr.extend('rmail',rr.expansion_event,{
addShortcut:function(p1,p2,p3){
if(rr.shortcut)return rr.shortcut.add(p1,p2,p3);
rr.include.load('rr.shortcut',function(){
if(rr.shortcut)rr.shortcut.add(p1,p2,p3);
});
}
});
window.onbeforeunload=function(){
var e={message:false};
rmail.initEvent('closeWindow',e);
if(e.message)return e.message;
window.onerror=null;
}
new function(){
if((window.google&&google.gears)||rr.is.Kqn)return;
var fc;
if(typeof GearsFactory=='undefined'){
try{
fc=new ActiveXObject('Gears.Factory');
if(fc.getBuildInfo().indexOf('ie_mobile')!=-1)fc.privateSetGlobalObject(this);
}catch(e){
if((typeof navigator.mimeTypes!='undefined')&&navigator.mimeTypes["application/x-googlegears"]){
fc=document.createElement("object");
fc.style.display="none";
fc.width=0;
fc.height=0;
fc.type="application/x-googlegears";
document.documentElement.appendChild(fc);
}
}
}else fc=new GearsFactory();
if(!fc)return;
if(!window.google)google={};
if(!google.gears)google.gears={factory:fc};
};
rr.evLoad=new rr.class_objEvent();
rr.addInitDOM(function(){rr.evLoad.removeEventAll()});
$is=rr.is;
addInitDOM=rr.addInitDOM;
$gId=rr.gId;
killBubble=rr.killBubble;
addHandler=rr.addHandler;
removeHandler=rr.removeHandler;
getClientWH=rr.getClientWH;
getAbsolutePos=rr.getAbsolutePos;
getPx=rr.getPx;
getCStyle=rr.getCStyle;
getSelectedText=rr.getSelectedText;
gParentNode=function(nd,t,f){
return rr.getParentNode(t,nd,f);
};
function $oExtend(a1,a2,a3){
return rr.init(a1,a2,a3);
};
$css=rr.extend(function(o){
var t=arguments.callee;
return{
object:t._g(o),
all:function(n){
n=n||this.object;
if(n)return n.className.split(t._rxPrb);
},
exists:function(cl,n,ac){
return t.exists(cl,ac||n||this.object);
},
add:function(cl){
return t.add(cl,this.object);
},
remove:function(cl){
t.remove(cl,this.object);
},
set:function(cl,f){
return t.set(cl,this.object,f);
},
flip:function(cl){
return t.flip(cl,this.object);
},
parentNode:function(cl,f){
return t.parentNode(cl,this.object,f);
},
firstChild:function(cl){
return t.firstChild(cl,this.object);
},
nextSibling:function(cl){
return t.nextSibling(cl,this.object)
}
};
},rr.css);
rr.saveSetting=function(){};
rr.init(function(){
var xhr=new rr.class_xhrloader({
urlResource:location.pathname.replace(/\/mail\/mail\.cgi/,"/mail/settings.cgi?mode=json"),
metodRequest:'POST',
contentType:'multipart/form-data',
startTimeout:70,
timeout:70,
setconst:{
request_key:window._request_key||'no',
result:'comment'
}
});
if(!xhr)return;
rr.saveSetting=function(name,value){
if(!name)return;
xhr.set({
set_name:name+"",
set_value:value+""
});
xhr.fastSend()
};
});
rr.ui_setupPopupMenu=function(a,b){
var nd=rr.$(a),
pnd=rr.$(b),
css=rr.css,pauseHide,
timerHide,timerShow,timerStHide,flShow;
if(!nd||!pnd)return;
css.remove('csshover',pnd);
nd.onmouseover=function(){
pauseHide=true;
if(css.exists('jshover',pnd))return show();
if(!timerShow)timerShow=window.setTimeout(show,200);
};
nd.onmousemove=function(){
pauseHide=true;
if(!timerShow||css.exists('jshover',pnd))return;
window.clearInterval(timerShow);
timerShow=window.setTimeout(show,200);
};
nd.onmousedown=function(e){
return rr.stopEventDefault(e);
};
nd.onclick=function(e){
if(css.exists('jshover',pnd)){
if(!timerStHide)hide();
}else show();
return rr.stopEventDefault(e);
};
pnd.onmouseover=function(e){
window.clearInterval(timerHide);
timerHide=null;
setLiHover(e,true);
};
pnd.onmouseout=function(e){
if(!timerHide)timerHide=window.setTimeout(hide,800);
window.clearInterval(timerShow);
timerShow=null;
setLiHover(e);
};
function setLiHover(e,fl){
if($is.IE<7||true){
e=e||window.event;
var tg=e.target||e.srcElement;
while(tg&&tg.tagName!=='LI'){
if(tg===pnd)return;
tg=tg.parentNode;
};
if(tg&&tg!==pnd)css.set('jshover',tg,fl);
};
};
function show(){
_clear();
css.add('jshover',pnd);
flShow=true;
if(timerStHide)window.clearInterval(timerStHide);
timerStHide=window.setTimeout(function(){
timerStHide=null;
},pauseHide?400:100);
pauseHide=false;
};
function hide(){
css.remove('jshover',pnd);
_clear();
};
function _clear(){
window.clearInterval(timerHide);
window.clearInterval(timerShow);
timerHide=null;
timerShow=null;
flShow=null;
};
rr.addHandler(document,'mousedown',function(e){
if(!flShow)return;
e=e||window.event;
var tg=e.target||e.srcElement,nd;
while(tg&&tg.tagName){
if(tg==pnd)return;
tg=tg.parentNode;
};
hide();
});
};
rr.addInitDOM(function(){
rr.ui_setupPopupMenu('topmenu-dropdown','topmenu-all-folders');
});
if(rr.IE<7)new function(){
var tm;
rr.addHandler(window,'resize',function(){
clearTimeout(tm);
tm=setTimeout(resize,10);
});
new function resize(){
var d=document;
d=rr.qIE?d.body:d.documentElement;
if(!d)return;
rr.css.set('winNarrow',document.documentElement,d.clientWidth<900);
};
};
function ramac_event(evt){
return(evt)?evt:((window.event)?event:null);
}
function ramac_cancel(evt){
evt.returnValue=false;
evt.cancelBubble=true;
if(evt.preventDefault){
evt.preventDefault();
}
if(evt.stopPropagation){
evt.stopPropagation();
}
}
function evt_cancel(evt){
evt=ramac_event(evt);
if(evt)ramac_cancel(evt);
return false;
}
var undefined;
$=get_node=!document.getElementById
?function(e){return typeof e=='string'?undefined:e}
:function(e){
if(typeof e==='string'){
return document.getElementById(e);
}else{
return e;
}
};
function evt_coords(evt){
var coords={left:0,top:0};
if(evt.pageX){
coords.left=evt.pageX;
coords.top=evt.pageY;
}else if(evt.clientX){
coords.left=
evt.clientX+document.body.scrollLeft-document.body.clientLeft;
coords.top=
evt.clientY+document.body.scrollTop-document.body.clientTop;
if(document.body.parentElement&&document.body.parentElement.clientLeft){
var bodParent=document.body.parentElement;
coords.left+=bodParent.scrollLeft-bodParent.clientLeft;
coords.top+=bodParent.scrollTop-bodParent.clientTop;
}
}
return coords;
}
function ramac_add_handler(element,event_type,func){
if(element.attachEvent){
element.attachEvent('on'+event_type,func);
}else if(element.addEventListener){
element.addEventListener(event_type,func,false);
}else{
element['on'+event_type]=func;
}
}
function ramac_remove_handler(element,event_type,func){
if(element.detachEvent){
element.detachEvent('on'+event_type,func);
}else if(element.removeEventListener){
element.removeEventListener(event_type,func,false);
}else{
element['on'+event_type]=null;
}
}
function ramac_http(){
var req=null;
if(!req&&window.XMLHttpRequest){
req=new XMLHttpRequest();
}
if(!req){
var progids=['MSXML2.XmlHttp.4.0','MSXML2.XmlHttp','Microsoft.XmlHttp'];
for(var index=0;index<progids.length;++index){
try{
req=new ActiveXObject(progids[index]);
break;
}catch(ex){
req=null;
}
}
}
return req;
}
function zebra_table(id){
if(!document.getElementById)return;
var even=false;
var table=document.getElementById(id);
if(!table){return;}
var tbodies=table.getElementsByTagName("tbody");
for(var h=0;h<tbodies.length;h++){
var trs=tbodies[h].getElementsByTagName("tr");
for(var i=0;i<trs.length;i++){
if(even){
add_class(trs[i],'even');
}else{
add_class(trs[i],'odd');
}
even=!even;
}
}
}
function add_class(element,class_name){
if(element&&element.className.indexOf(class_name)==-1)
element.className+=" "+class_name;
}
function remove_class(element,class_name){
if(!element)return;
element.className=element.className.replace(class_name,"");
}
function caret_pos(input){
var r=document.selection.createRange();
var r1=r.duplicate();
r1.moveToElementText(input);
r1.setEndPoint('EndToEnd',r);
input.caret_pos=r1.text.length;
}
EMAIL_REGEX=/([^()<>\[\]:;@\\," ]+|"[^\\"]*(\\.[^\\"]*)*")@([\w-]+\.)+[a-zA-Z]{2,7}/;
function set_cookie(name,value,expires,path,domain,secure){
var expires_date;
if(expires){
var today=new Date();
today.setTime(today.getTime());
expires=expires*1000;
expires_date=new Date(today.getTime()+expires);
}
document.cookie=name+"="+escape(value)+
(expires_date?";expires="+expires_date.toGMTString():"")+
(path?";path="+path:"")+
(domain?";domain="+domain:"")+
(secure?";secure":"");
}
function get_cookie(name){
var c=document.cookie;
var start_index=c.indexOf(name+'=')
if(start_index==-1)
return null;
var end_index=c.indexOf(";",start_index+name.length+1);
if(end_index==-1)
end_index=c.length;
return unescape(c.substring(start_index+name.length+1,end_index));
}
function hide_banner(banner_el){
if(banner_el){
banner_el.style.display='none';
if(banner_el.id=='banner-right'&&$('inner'))
$('inner').style.width='100%';
}
}
function install_banner(banner,expires){
if(!document.getElementById)return;
var x,b;
if(!(b=$(banner)))return;
if(x=$(banner+'-x'))
ramac_add_handler(x,'click',function(evt){
hide_banner(b);
if(typeof set_cookie=='function')
set_cookie(banner+'-axed','yep',(typeof expires=='undefined'?600:expires),'/mail/');
return evt_cancel(evt);
});
var i;
if(i=$(banner+'-include')){
var empty=1;
for(i=i.firstChild;i;i=i.nextSibling){
if(i.nodeType==1&&i.nodeName&&i.nodeName.indexOf('!')<0&&i.nodeName.indexOf('#')<0){
empty=0;
break;
}
}
if(empty)
hide_banner(b);
}
}
function install_confirmation(element,message,skip_func){
if(element&&message){
ramac_add_handler(element,'click',function(evt){
if((skip_func&&skip_func(element))||!confirm(message))
evt_cancel(evt);
});
}
}
function checklist_install(checkboxes,check_all){
};
function checklist_any(checkboxes){
if(!checkboxes)return false;
var items=checkboxes.length?checkboxes:[checkboxes];
for(var i=0;i<items.length;++i)
if(items[i].checked)
return true;
return false;
}
function install_page_shortcut(filter,handler){
if(filter&&handler)
ramac_add_handler(document,'keypress',function(evt){
evt=ramac_event(evt);
var is_top_tag=evt&&(evt.target&&evt.target.tagName=='HTML'||evt.srcElement&&evt.srcElement.tagName=='BODY');
if(is_top_tag&&filter(evt))
handler(evt);
});
}
function install_document_shortcut(filter,handler,ev){
if(filter&&handler)
ramac_add_handler(document,ev||'keydown',function(evt){
evt=ramac_event(evt);
if(filter(evt))
handler(evt);
});
}
function is_text_edit_event(evt){
if(evt){
var target=evt.target||evt.srcElement;
if(target){
if(target.tagName.toLowerCase()=='textarea')
return true;
if(target.type&&target.type.toLowerCase()=='text')
return true;
}
}
return false;
}
function install_showhide_checkbox(el_link,el_showed){
if(!$(el_link)||!$(el_showed))
return;
var el=$(el_showed);
var fn=function(){el.style.display=$(el_link).checked?'':'none';};
fn();
ramac_add_handler($(el_link),'click',fn);
}
function check_avatar(obj,email,quite){
if(!obj)return;
obj.onload=null;
var w,h;
w=obj.clientWidth;
h=obj.clientHeight;
if(obj&&w<4&&h<4){
var p=obj.parentNode;
if(p.nodeType==1&&p.nodeName=='A'){
p=p.parentNode;
}
if(quite){
p.innerHTML='';
}else{
obj.src=(window._static_host||'')+'/i/no_avatar_web.jpg';
obj.width=100;
obj.height=100;
}
};
rr.css.add('loaded',obj);
};
function check_avatar_head(obj){
if(!obj)return;
obj.onload=null;
rr.css.add('loaded',obj);
var os=obj.style,w,h,sw=os.width,sh=os.height;
os.width=os.height='auto';
w=obj.clientWidth;
h=obj.clientHeight;
if(obj&&w<4&&h<4){
os.width=os.height='';
obj.src=(window._static_host||'')+'/i/no_avatar_small.jpg';
rr.css.add('noavatar',obj);
try{
var p=obj.parentNode;
p.title=title_no_avatar;
}catch(e){};
return;
};
if(sw)os.width=sw;
if(sh)os.height=sh;
};
rr.addInitDOM(function(){
var nd=rr.$('banner-top');
if(nd&&nd.offsetHeight<50)nd.parentNode.removeChild(nd);
});
rr.addInitDOM(function(){
var n=location.href.lastIndexOf('#'),r;
if(n<0)return;
r=location.href.substr(n);
r=r&&rr.$(r);
if(r)r.scrollIntoView();
window.focus();
});
