gwwa.ns("gwwa.mlogin");gwwa.mlogin.constants={};gwwa.mlogin.constants.SETTINGS_BTN_EXPANDED="SettingsButtonExpanded";gwwa.mlogin.constants.USER_LANG="Cookie.User.lang";gwwa.mlogin.constants.USER_NAME="Cookie.User.name";gwwa.mlogin.constants.ID_BG_FILLER="idBGFiller";gwwa.mlogin.constants.MON_JAN=0;gwwa.mlogin.constants.MON_MAR=2;gwwa.mlogin.constants.MON_JUL=6;gwwa.mlogin.constants.MON_OCT=9;gwwa.mlogin.constants.MON_DEC=11;gwwa.mlogin.init=function(){if(gwwa.mobile){gwwa.mobile.deleteCSSFile();gwwa.mobile.setItemsPanelWidth();if((gwwa.mobile.isASUSTablet()||gwwa.mobile.isGalaxyTablet()||gwwa.mobile.isNexusTablet()||gwwa.mobile.isPixelTablet()||gwwa.mobile.isGoogleAndroid7OrHigherTablet())&&gwwa.mobile.isChromeBrowser()==false){alert(str_UnsupportedBrowser)}}var divLogin=$("idLogin");util.addClass(divLogin,"phoneWidth");gwwa.mlogin.setTimezoneParams();gwwa.mlogin.readLoginSettings();gwwa.mlogin.updatePanelPosition();if(gwwa.mobile){gwwa.mobile.hideLoading()}gwwa.mlogin.removeFillerNode();gwwa.mlogin.setFocus()};gwwa.mlogin.readLoginSettings=function(){var settingsBtnExpanded=readCookie(gwwa.mlogin.constants.SETTINGS_BTN_EXPANDED);if(settingsBtnExpanded){gwwa.mlogin.displaySettingsButton(true)}else{gwwa.mlogin.displaySettingsButton(false)}if(readCookie(gwwa.mlogin.constants.USER_LANG)!="ar"){var simpleInterface=readCookie("SimpleInterface");if(simpleInterface){var simpleInterfaceCheckbox=$("idSimpleInterface");if(simpleInterfaceCheckbox){simpleInterfaceCheckbox.checked=true;gwwa.mlogin.disableArabicOpForSimple()}}}else{gwwa.mlogin.disableSimpleInterfaceChckbox()}var rememberMe=readCookie("RememberMe");if(rememberMe){var rememberMeCheckbox=$("idRememberMe");if(rememberMeCheckbox){rememberMeCheckbox.checked=true}}var userName=readCookie(gwwa.mlogin.constants.USER_NAME);if(userName){$("username").value=decodeURIComponent(userName);deleteCookie(gwwa.mlogin.constants.USER_NAME)}gwwa.mlogin.selectLang()};gwwa.mlogin.displaySettingsButton=function(bDisplay){var settingsBtn=$("settingsBtn");if(settingsBtn){var optionsBox=$("optionsBox");if(bDisplay){util.removeClass(optionsBox,"hidden")}else{util.addClass(optionsBox,"hidden")}}};gwwa.mlogin.toggleSettingsButton=function(){var settingsBtnExpanded=readCookie(gwwa.mlogin.constants.SETTINGS_BTN_EXPANDED);if(settingsBtnExpanded){gwwa.mlogin.displaySettingsButton(false);deleteCookie(gwwa.mlogin.constants.SETTINGS_BTN_EXPANDED)}else{gwwa.mlogin.displaySettingsButton(true);writeCookie(gwwa.mlogin.constants.SETTINGS_BTN_EXPANDED,"true")}};gwwa.mlogin.handleLangChange=function(){var userLang;var extraURL="";var langSelect=$("idLangSelect");if(langSelect){userLang=langSelect.options[langSelect.selectedIndex].value}if(gwwa.user&&gwwa.user.lang&&userLang!=gwwa.user.lang){var userName=$("username").value;writeCookie(gwwa.mlogin.constants.USER_NAME,encodeURIComponent(userName));if(userLang=="ar"){var simpleInterface=readCookie("SimpleInterface");if(simpleInterface){deleteCookie("SimpleInterface")}gwwa.mlogin.disableSimpleInterfaceChckbox()}extraURL="?User.id="+encodeURIComponent(userName)}writeCookie(gwwa.mlogin.constants.USER_LANG,userLang);window.location.href=inc_homeURL+extraURL};gwwa.mlogin.disableSimpleInterfaceChckbox=function(){document.getElementById("idSimpleOption").style.visibility="hidden"};gwwa.mlogin.disableArabicOpForSimple=function(){var selLang=document.getElementById("idLangSelect");if(selLang){selLang.remove(1)}};gwwa.mlogin.selectLang=function(){var userLang=readCookie(gwwa.mlogin.constants.USER_LANG);if(!userLang){userLang=(gwwa.user)?gwwa.user.lang:null}var selLang=document.getElementById("idLangSelect");if(selLang){for(var i=0;i<selLang.options.length;i++){if(userLang===selLang.options[i].value){selLang.options[i].selected=true;break}}}};gwwa.mlogin.setTimezoneParams=function(){gwwa.mlogin.computeTimezoneValues()};gwwa.mlogin.getTimezoneURL=function(){return gwwa.mlogin.computeTimezoneValues(true)};gwwa.mlogin.updateTimezone=function(){var timezoneURL=gwwa.mlogin.getTimezoneURL();var callback={success:gwwa.mlogin.timezoneHandler,failure:gwwa.mlogin.timezoneHandler,argument:null};YAHOO_util_Connect_asyncRequest("GET",timezoneURL,callback,null)};gwwa.mlogin.timezoneHandler=function(){};gwwa.mlogin.showForm=function(){document.forms.loginForm.style.visibility="visible"};gwwa.mlogin.setFocus=function(){var elemUserName=$("username");if(gwwa.browser.name=="MSIE"&&!isIE9OrAbove()){}else{elemUserName.focus();elemUserName.select()}};gwwa.mlogin.removeFocus=function(){document.getElementById("username").blur()};gwwa.mlogin.updatePanelPosition=function(){if(gwwa.mobile&&(gwwa.mobile.isASUSTablet()||gwwa.mobile.isGalaxyTablet())){return false}var panel=$("idLogin");if(panel){var totalheight=document.documentElement.clientHeight;var panelHeight=panel.offsetHeight;var newTop=(totalheight-panelHeight)/4;newTop=(newTop<0)?0:newTop;panel.parentNode.style.paddingTop=newTop+"px";gwwa.mlogin.fixWebkitBackgroundImages()}};gwwa.mlogin.removeFillerNode=function(){var node=$(gwwa.mlogin.constants.ID_BG_FILLER);if(node){var parentNode=node.parentNode;parentNode.removeChild(node)}};function findDSTStartDate(date1,date2){var today=new Date();var startMonth=gwwa.mlogin.constants.MON_JAN;var endMonth=gwwa.mlogin.constants.MON_JUL;if(!date1){date1=new Date(today.getFullYear(),gwwa.mlogin.constants.MON_JAN,1,12,0,0)}if(!date2){date2=new Date(today.getFullYear(),gwwa.mlogin.constants.MON_JUL,1,12,0,0)}if(date1.getTimezoneOffset()==date2.getTimezoneOffset()){if(gwwa.mlogin.isRussianTimezone()){return gwwa.mlogin.getRussianTZStartDate()}else{return null}}while(date1.getTimezoneOffset()<=date2.getTimezoneOffset()){date1=new Date(today.getFullYear(),startMonth++,1);endMonth=endMonth>=11?11:endMonth++;date2=new Date(today.getFullYear(),endMonth++,1)}while(date1.getTimezoneOffset()>date2.getTimezoneOffset()){var day1=dayOfYear(date1);var day2=dayOfYear(date2);mid=Math.floor((day2-day1)/2);mid=mid==0?1:mid;var temp1=new Date(date1.getTime()+(mid*(24*60*60*1000)));var temp2=new Date(date2.getTime()-(mid*(24*60*60*1000)));if(temp1.getTimezoneOffset()>date2.getTimezoneOffset()){date1=temp1}else{if(temp2.getTimezoneOffset()<date1.getTimezoneOffset()){date2=temp2}else{if(temp1.getTimezoneOffset()==date2.getTimezoneOffset()&&temp1.getTime()<date2.getTime()){var tempDate=new Date(temp1.setTime(temp1.getTime())-(15*60*60*1000));if(tempDate.getTimezoneOffset()==temp1.getTimezoneOffset()){return tempDate}return temp1}if(date1.getTimezoneOffset()>date2.getTimezoneOffset()){var tempDate=new Date(date2.setTime(temp1.getTime())-(15*60*60*1000));if(tempDate.getTimezoneOffset()==date2.getTimezoneOffset()){return tempDate}return date2}var tempDate=new Date(date1.setTime(temp1.getTime())-(15*60*60*1000));if(tempDate.getTimezoneOffset()==date1.getTimezoneOffset()){return tempDate}return date1}}}return null}function getDSTStartDate(){var dstDate=findDSTStartDate();var retValue=null;if(dstDate){retValue=dstDate.getUTCFullYear()+"-"+(dstDate.getUTCMonth()+1)+"-"+dstDate.getUTCDate();var tempDSTStartDate=getDSTStartTime(dstDate);if(tempDSTStartDate!=null){retValue+="T"+tempDSTStartDate.getUTCHours()+":"+tempDSTStartDate.getUTCMinutes()}}return retValue}function getDSTStartTime(dstStartDate){var retValue=null;var oneHour=60*60*1000;var date1=null;var date2=null;if(dstStartDate!=null){for(var idx=0;idx<24;idx++){if(date1==null){date1=new Date(dstStartDate.getTime());date1.setHours(0);date1.setMinutes(0)}else{date1=date2}if(date2==null){date2=new Date(date1.getTime()+oneHour)}else{date2=new Date(date2.getTime()+oneHour)}if(date1.getTimezoneOffset()==date2.getTimezoneOffset()){continue}else{retValue=date2;break}}}return retValue}function findDSTEndDate(date1,date2){var today=new Date();var startMonth=gwwa.mlogin.constants.MON_JAN;var endMonth=gwwa.mlogin.constants.MON_JUL;if(!date1){date1=new Date(today.getFullYear(),gwwa.mlogin.constants.MON_JAN,1,12,0,0)}if(!date2){date2=new Date(today.getFullYear(),gwwa.mlogin.constants.MON_JUL,1,12,0,0)}if(date1.getTimezoneOffset()==date2.getTimezoneOffset()){if(gwwa.mlogin.isRussianTimezone()){return gwwa.mlogin.getRussianTZEndDate()}else{return null}}while(date1.getTimezoneOffset()>=date2.getTimezoneOffset()){date1=new Date(today.getFullYear(),startMonth++,1);endMonth=endMonth>=11?11:endMonth++;date2=new Date(today.getFullYear(),endMonth++,1)}while(date1.getTimezoneOffset()<date2.getTimezoneOffset()){var day1=dayOfYear(date1);var day2=dayOfYear(date2);mid=Math.floor((day2-day1)/2);mid=mid==0?1:mid;var temp1=new Date(date1.getTime()+(mid*(24*60*60*1000)));var temp2=new Date(date2.getTime()-(mid*(24*60*60*1000)));if(temp1.getTimezoneOffset()<date2.getTimezoneOffset()){date1=temp1}else{if(temp2.getTimezoneOffset()>date1.getTimezoneOffset()){date2=temp2}else{if(temp1.getTimezoneOffset()==date2.getTimezoneOffset()&&temp1.getTime()>date2.getTime()){var tempDate=new Date(temp1.setTime(temp1.getTime())-(15*60*60*1000));if(tempDate.getTimezoneOffset()==temp1.getTimezoneOffset()){return tempDate}return temp1}if(date1.getTimezoneOffset()<date2.getTimezoneOffset()){var tempDate=new Date(date2.setTime(temp1.getTime())-(15*60*60*1000));if(tempDate.getTimezoneOffset()==date2.getTimezoneOffset()){return tempDate}return date2}var tempDate=new Date(date1.setTime(temp1.getTime())-(15*60*60*1000));if(tempDate.getTimezoneOffset()==date1.getTimezoneOffset()){return tempDate}return date1}}}return null}function getDSTEndDate(){var retValue=null;var dstDate=findDSTEndDate();if(dstDate){retValue=dstDate.getUTCFullYear()+"-"+(dstDate.getUTCMonth()+1)+"-"+dstDate.getUTCDate();var tempDSTEndDate=getDSTEndTime(dstDate);if(tempDSTEndDate!=null){retValue+="T"+tempDSTEndDate.getUTCHours()+":"+tempDSTEndDate.getUTCMinutes()}}return retValue}function getDSTEndTime(dstEndDate){var retValue=null;var oneHour=60*60*1000;var date1=null;var date2=null;if(dstEndDate!=null){for(var idx=0;idx<24;idx++){if(date1==null){date1=new Date(dstEndDate.getTime());date1.setHours(0);date1.setMinutes(0)}else{date1=date2}if(date2==null){date2=new Date(date1.getTime()+oneHour)}else{date2=new Date(date2.getTime()+oneHour)}if(date1.getTimezoneOffset()==date2.getTimezoneOffset()){continue}else{retValue=date2;break}}}return retValue}function dayOfYear(d){var yn=d.getFullYear();var mn=d.getMonth();var dn=d.getDate();var d1=new Date(yn,0,1,12,0,0);var d2=new Date(yn,mn,dn,12,0,0);var ddiff=Math.round((d2-d1)/86400000);return ddiff+1}gwwa.mlogin.saveTimeoutCookie=function(checkbox){if(checkbox.value==="true"){writeCookie("RememberMe","true")}else{deleteCookie("RememberMe")}};gwwa.mlogin.enableAutoComplete=function(flag){var username=document.getElementById("username");var password=document.getElementById("password");if(flag===true){username.autocomplete="on";password.autocomplete="on"}else{username.autocomplete="off";password.autocomplete="off"}};gwwa.mlogin.objConfig=function(close,modal,zindex,fixedcenter,visible,constraintoviewport,iframe,width,height,draggable){this.close=close;this.modal=modal;this.zindex=zindex;this.fixedcenter=fixedcenter;this.visible=visible;this.constraintoviewport=constraintoviewport;this.iframe=iframe;this.width=width;this.height=height;this.draggable=draggable};gwwa.mlogin.objCFInstallOpt=function(mode,destination){this.mode=mode;this.destination=destination};gwwa.mlogin.isBrowserSupported=function(){if(gwwa.browser.name=="MSIE"&&gwwa.browser.mjrVer<8){return false}else{return true}};gwwa.mlogin.isInIE7Mode=function(){if(gwwa.browser.name=="MSIE"&&gwwa.browser.mjrVer==7&&navigator.userAgent.indexOf("Trident")>-1){return true}else{return false}};gwwa.mlogin.installChromeFrame=function(){deleteCookie("SimpleInterface");var options=new gwwa.mlogin.objCFInstallOpt("popup",window.location.href);if(typeof CFInstall!=="undefined"){CFInstall.check(options)}};gwwa.mlogin.goToBasicInterface=function(){writeCookie("SimpleInterface","true");window.location=homeURL+"?User.interface=simple"};gwwa.mlogin.showBrowserUnsupportedDialog=function(){document.getElementById("idDlgBrowserUnsupported").style.display="block";if(gwwa.browser.name!="MSIE"||(gwwa.browser.name=="MSIE"&&gwwa.browser.mjrVer<6)){document.getElementById("idRowMSIE").style.display="none"}var height=document.getElementById("idCaptionDlg").offsetHeight;height=height+document.getElementById("idDlg").offsetHeight+inc_paddingDlgInPx+"px";var dlgConfig=new gwwa.mlogin.objConfig(false,true,30,true,false,true,false,inc_widthDlgInPx+"px",height,true);dlgBrowserUnsuppored=YAHOO_widget_Panel("idDlgBrowserUnsupported",dlgConfig);dlgBrowserUnsuppored.render(document.body);dlgBrowserUnsuppored.show()};gwwa.mlogin.redirectUser=function(){var elements=document.loginForm.elements;var sURL=homeURL+"?";for(var i=0;i<elements.length;i++){if(gwwa.mlogin.skipThisParam(elements[i].name)===false){var control=elements[i];if(control.type!=="checkbox"||control.checked===true){sURL+=control.name+"="+encodeURI(control.value)+"&"}}}sURL+="merge=webacc";window.location.href=sURL};gwwa.mlogin.skipThisParam=function(param){var skipParamsList=["User.id","User.password","merge","User.keepLoggedIn"];for(var i=0;i<skipParamsList.length;i++){if(skipParamsList[i]===param){return true}}return false};gwwa.mlogin.handleAutoLogin=function(){if(inc_tryAutoLogin===true&&readCookie("NJSCNKLI")!=null){document.loginForm.elements["User.id"].value=document.loginForm.elements["User.password"].value="";gwwa.mlogin.redirectUser()}else{document.getElementById("idLogin").style.visibility="visible"}};gwwa.mlogin.showCompatibilityViewDialog=function(){document.getElementById("idDlgCompatibilityView").style.display="block";var height=document.getElementById("idCaptionDlg1").offsetHeight;height=height+document.getElementById("idDlg1").offsetHeight+inc_paddingDlgInPx+"px";var dlgConfig=new gwwa.mlogin.objConfig(false,true,30,true,false,true,false,inc_widthDlg1InPx+"px",height,false);dlgBrowserUnsuppored=YAHOO_widget_Panel("idDlgCompatibilityView",dlgConfig);dlgBrowserUnsuppored.render(document.body);dlgBrowserUnsuppored.show()};gwwa.mlogin.autoRedirectUnsupported=function(){document.getElementById("idDlgAutoRedirect").style.display="block";var height=document.getElementById("idCaptionDlg2").offsetHeight;height=height+document.getElementById("idDlg2").offsetHeight+inc_paddingDlgInPx+"px";var dlgConfig=new gwwa.mlogin.objConfig(false,true,30,true,false,true,false,inc_widthDlg1InPx+"px",height,false);dlgBrowserUnsuppored=YAHOO_widget_Panel("idDlgAutoRedirect",dlgConfig);dlgBrowserUnsuppored.render(document.body);dlgBrowserUnsuppored.show()};gwwa.mlogin.isRussianTimezone=function(){var firstDayOfYear=new Date(2014,gwwa.mlogin.constants.MON_JAN,1,12,0,0);var lastDayOfYear=new Date(2014,gwwa.mlogin.constants.MON_DEC,31,12,0,0);var isRTZ2=(firstDayOfYear.getTimezoneOffset()==-240&&lastDayOfYear.getTimezoneOffset()==-180);return isRTZ2};gwwa.mlogin.getRussianTZStartDate=function(){var rtzStartDate=new Date(2011,gwwa.mlogin.constants.MON_MAR,27,12,0,0);return rtzStartDate};gwwa.mlogin.getRussianTZEndDate=function(){var rtzEndDate=new Date(2014,gwwa.mlogin.constants.MON_OCT,26,12,0,0);return rtzEndDate};gwwa.mlogin.computeTimezoneValues=function(isReturnTypeURL){var SummerDate=new Date();var WinterDate=new Date();var CurrentGMTOffset=new Date().getTimezoneOffset();SummerDate.setTime(Date.parse("July 1, "+SummerDate.getFullYear()));WinterDate.setTime(Date.parse("January 1, "+SummerDate.getFullYear()));var dstStartDate=getDSTStartDate();if(dstStartDate!=null){var tempDSTStartDate=findDSTStartDate();var offsetDST=-1*tempDSTStartDate.getTimezoneOffset();var offsetSTD=-1*(new Date(tempDSTStartDate.getTime()-(24*60*60*1000)).getTimezoneOffset());var dstEndDate=getDSTEndDate();if(dstEndDate!=null){if(offsetDST==offsetSTD){offsetSTD=-1*(new Date(findDSTEndDate().getTime()+(24*60*60*1000)).getTimezoneOffset())}}}var isOffsetAvailable="1";var gmtOffset=(-1*CurrentGMTOffset).toString();var hasDaylight=(((SummerDate.getTimezoneOffset()!==WinterDate.getTimezoneOffset())||(gwwa.mlogin.isRussianTimezone()))?"1":"0");var isInDaylight=((CurrentGMTOffset<Math.max(WinterDate.getTimezoneOffset(),SummerDate.getTimezoneOffset()))?"1":"0");if(isReturnTypeURL){var timezoneURL=homeURL+"?User.context="+userContext+"&action=Timezone.Update&merge=jerror";if(dstStartDate!=null){timezoneURL+="&Timezone.Workstation.dstStartDate="+dstStartDate}if(dstEndDate!=null){timezoneURL+="&Timezone.Workstation.dstEndDate="+dstEndDate}timezoneURL+="&Timezone.Workstation.dstOffset="+offsetDST;timezoneURL+="&Timezone.Workstation.stdOffset="+offsetSTD;timezoneURL+="&Timezone.Workstation.offsetAvailable="+isOffsetAvailable;timezoneURL+="&Timezone.Workstation.gmtOffset="+gmtOffset;timezoneURL+="&Timezone.Workstation.HasDaylight="+hasDaylight;timezoneURL+="&Timezone.Workstation.IsDaylight="+isInDaylight;return timezoneURL}else{if(dstStartDate!=null){document.getElementById("WorkstationDSTStartDate").value=dstStartDate}if(dstEndDate!=null){document.getElementById("WorkstationDSTEndDate").value=dstEndDate}document.getElementById("WorkstationDsttz").value=offsetDST;document.getElementById("WorkstationStdtz").value=offsetSTD;document.getElementById("WorkstationOffsetAvailable").value=isOffsetAvailable;document.getElementById("WorkstationGMTOffset").value=gmtOffset;document.getElementById("WorkstationHasDaylight").value=hasDaylight;document.getElementById("WorkstationIsDaylight").value=isInDaylight}};gwwa.mlogin.fixWebkitBackgroundImages=function(){if(gwwa.webacc.isWebkitBrowser()){var imgUserId=$("imgUserid");var inputUserId=$("username");gwwa.mlogin.fixWebkitBGImgPosition(imgUserId,inputUserId);var imgPwd=$("imgPwd");var inputPwd=$("password");gwwa.mlogin.fixWebkitBGImgPosition(imgPwd,inputPwd)}};gwwa.mlogin.fixWebkitBGImgPosition=function(imgNode,inputNode){if(imgNode&&inputNode){imgNode.style.left=util.getOffsetLeft(inputNode)+17+"px";imgNode.style.top=util.getOffsetTop(inputNode)+10+"px"}};