function utility_include_page_onload() {
    if ( m_oLogin.szGroupFunc.indexOf("LIVEVIEW") >= 0) {
        if ( oUtility.GetControlKey(14) == 1) {
            if ( m_oLogin.szPreviewMode ) {
                var date = new Date();
                    date.setTime( date.getTime()+86400000 ) ;
                document.cookie = "ACTiNVR=" + m_oLogin.szPreviewMode + "; expires=" + date.toGMTString();
            }
            else {
                m_oLogin.szPreviewMode = GetCookie("ACTiNVR") ; 
            }
        }

        if (m_oLogin.szPreviewMode=='Advanced') {
            top.utility_set_control_key( m_oLogin.szUserID, m_oLogin.szUserName, m_oLogin.szUserGroup, m_oLogin.szGroupFunc, m_oLogin.szServerIP, m_oLogin.szDispUser, m_oLogin.szShowLang);
            window.location.href = "\\active-monitor.htm" ;  
            return false ;
        } else {            
            var szFileName = "customization/r-preview/remote_preview_layout.htm" ;
            document.getElementById("defFRM_Main").src = szFileBase + szFileName ;
        }
    }
    else if ( m_oLogin.szGroupFunc.indexOf("PLAYBACK") >= 0)
    {
        top.utility_set_control_key( m_oLogin.szUserID, m_oLogin.szUserName, m_oLogin.szUserGroup, m_oLogin.szGroupFunc, m_oLogin.szServerIP, m_oLogin.szDispUser, m_oLogin.szShowLang);
        top.Preview("ACTION?PAGE=PLAYBACK") ;
    }
    else if ( m_oLogin.szGroupFunc.indexOf("SETUP") >= 0)
    {		
        top.utility_set_control_key( m_oLogin.szUserID, m_oLogin.szUserName, m_oLogin.szUserGroup, m_oLogin.szGroupFunc, m_oLogin.szServerIP, m_oLogin.szDispUser, m_oLogin.szShowLang);
        top.Preview("ACTION?PAGE=SETTING") ;
    }
    else if ( m_oLogin.szGroupFunc.indexOf("EMAP-VIEWER") >= 0)
    {		
        top.utility_set_control_key( m_oLogin.szUserID, m_oLogin.szUserName, m_oLogin.szUserGroup, m_oLogin.szGroupFunc, m_oLogin.szServerIP, m_oLogin.szDispUser, m_oLogin.szShowLang);
        top.Preview("ACTION?PAGE=EMAP") ;
    }
    else 
    {
        alert('Permission Denied.');
            
        return false;
    }
}

function GetCookie(sName) {
	var aCookie = document.cookie.split("; ");
	for (var i=0; i < aCookie.length; i++) {
		var aCrumb = aCookie[i].split("=");
		if (sName == aCrumb[0]) {
			if ( aCrumb[1] == undefined ) return "" ;
			return unescape(aCrumb[1]);
		}
	}
	return "";
}