nokia.mymessaging.dom=function(){var _rtls="\u0591-\u07FF\uFB00-\uFBFF\uFE70-\uFEFC",_rtlRe=new RegExp("^["+_rtls+"]");var _isRtlText=function isRtlText(val){return _rtlRe.test(val);};return{rgbSplit:function(rgb){var re=new RegExp(/\((.*)\)/);var arr=re.exec(rgb)[1].split(",");if(arr.length==3){return{R:parseInt(arr[0]),G:parseInt(arr[1]),B:parseInt(arr[2])};}else{if(arr.length==4){return{R:parseInt(arr[1]),G:parseInt(arr[2]),B:parseInt(arr[3])};}}return{R:0,G:0,B:0};},detectAndSetDirection:function(elem){elem.dir=_isRtlText(elem.innerHTML)?"rtl":"ltr";},touchHandler:function(){var _tactileFeedbackUri="cmail://tactilefeedback/",_SCROLL_UP=-1,_SCROLL_DOWN=1,_scrollPollingPeriod=200,_scrollendCallback=null;var _scrolling=function(scrollY,direction){var newScrollY=window.scrollY;if(scrollY!=newScrollY){setTimeout(function(){_scrolling(newScrollY,(scrollY<newScrollY?_SCROLL_DOWN:_SCROLL_UP));},_scrollPollingPeriod);}else{nokia.mymessaging.dom.touchHandler.onEndScroll(direction);}};return{detachScrollHandler:function(){window.removeEventListener("scroll",nokia.mymessaging.dom.touchHandler.onStartScroll,false);},attachScrollHandler:function(callbackFn){_scrollendCallback=callbackFn;window.addEventListener("scroll",nokia.mymessaging.dom.touchHandler.onStartScroll,false);},onStartScroll:function(){_scrolling(-1);},onEndScroll:function(direction){if((_scrollendCallback!==null)&&(typeof(_scrollendCallback)=="function")){setTimeout(function(){_scrollendCallback(direction);},0);}},tactileFeedback:function(){try{location.href=_tactileFeedbackUri;}catch(ex){}}};}(),createNode:function(type,id,className){var node=document.createElement(type);if(id!==null){node.id=id;}if(className!==null){node.className=className;}return node;},hasCssClass:function(elementObj,cssClass){return(elementObj&&typeof(elementObj)==="object")?(elementObj.className.indexOf(cssClass)>=0):false;},appendCssClass:function(elementObj,cssClass){var idx=((elementObj&&typeof(elementObj)==="object")?elementObj.className.indexOf(cssClass):0);if(idx<0){elementObj.className=elementObj.className+" "+cssClass;}},removeCssClass:function(elementObj,cssClass){var idx=((elementObj&&typeof(elementObj)==="object")?elementObj.className.indexOf(cssClass):-1);if(idx>0){elementObj.className=elementObj.className.substring(0,idx-1)+elementObj.className.substring(idx+cssClass.length,elementObj.className.length);}else{if(idx===0){elementObj.className=elementObj.className.substring(idx+cssClass.length,elementObj.className.length);}}},getLeft:function(elementObj){var left=0;if(elementObj.offsetParent){while(true){left+=elementObj.offsetLeft;if(!elementObj.offsetParent){break;}elementObj=elementObj.offsetParent;}}else{if(elementObj.x){left+=elementObj.x;}}return left;},getTop:function(elementObj){var top=0;if(elementObj.offsetParent){while(true){top+=elementObj.offsetTop;if(!elementObj.offsetParent){break;}elementObj=elementObj.offsetParent;}}else{if(elementObj.y){top+=elementObj.y;}}return top;},removeImages:function(elem){var images=elem.getElementsByTagName("img");for(var i=0;i<images.length;i++){images[i].alt=images[i].src;images[i].src="#";}}};}();