function HtmlCleaner()
{
this.mAllowedTags = "*";
this.mAllowedAttributes = "*";
this.mAllowedStyles = "*";
this.mAllowedClasses = "*";
this.mInvalidInlineTagsRegExp = null;
this.mInvalidBlockTagsRegExp = null;
this.mAllowedQuotedAttributesRegExp = null;
this.mAllowedNonQuotedAttributesRegExp = null; 
this.mAllowedStylesRegExp = null;
this.mAllowedParagraphStylesRegExp = null;
}
HtmlCleaner.prototype.mAttributesRegExp = new RegExp( "(<[^/ >]+)( [^>]+)>", "gim" );
HtmlCleaner.prototype.mInlineTags = ",a,,acronym,,applet,,area,,b,,base,,basefont,,bdo,,bgsound,,big,,br,,button,,caption,,cite,,code,,comment,,custom,,del,,dfn,,em,,embed,,font,,frame,,frameset,,head,,html,,i,,img,,input,,ins,,isindex,,kbd,,label,,link,,map,,meta,,nobr,,noframes,,noscript,,o:p,,object,,optgroup,,option,,param,,q,,rt,,ruby,,s,,samp,,script,,select,,small,,span,,strike,,strong,,style,,sub,,sup,,tbody,,tfoot,,thead,,title,,tt,,u,,var,,wbr,,xml,";
HtmlCleaner.prototype.mBlockTags = ",address,,blockquote,,body,,center,,col,,colgroup,,dd,,dir,,div,,dl,,dt,,fieldset,,form,,h1,,h2,,h3,,h4,,h5,,h6,,hr,,iframe,,legend,,li,,listing,,marquee,,menu,,ol,,p,,plaintext,,pre,,table,,td,,textarea,,th,,tr,,ul,,xmp,";
HtmlCleaner.prototype.mServerHostRegExp = new RegExp( 'http(s?)://www.betabanen.nl/', 'gim' );
HtmlCleaner.prototype.mInternalLinkRegExp = new RegExp( 'http(s?)://www.betabanen.nl/.*?.lynkx', 'gim' );
HtmlCleaner.prototype.mSuperfluousSpaceRegExp = new RegExp( '(^((&nbsp;| )+|(<p[^>]*>(&nbsp;| )</p>)+))|(((&nbsp;| )+|(<p[^>]*>(&nbsp;| )</p>)+)$)', 'gi' );
HtmlCleaner.prototype.mInvalidXhtmlTags = new RegExp( "</?(tbody)[^>]*>", "gim" );
HtmlCleaner.prototype.mFixUnorderedLists = new RegExp( "<p[^>]*>\\D(?:&nbsp;)+(.*)</p>", "gi" );
HtmlCleaner.prototype.mNonQuotedAttributes = new RegExp( '(?:="([^"]+)")|(?:=([^ >]+))', 'gi' );
HtmlCleaner.prototype.AppendNodeXhtml = _HtmlCleaner_AppendNodeXhtml;
function _HtmlCleaner_AppendNodeXhtml( htmlElement, sbXhtml )
{
switch( htmlElement.nodeType )
{
case 1:
if ( htmlElement.cleanerParsed == true )
return;
var tagName = htmlElement.nodeName.toLowerCase();
if ( tagName == "!" )
break;
if ( tagName == "a" && ! IsEmpty( htmlElement.href ) )
{
if ( IsEmpty( htmlElement.innerHTML ) )
{
return;
}
else if ( htmlElement.href.substr(0,1) != "#"
&& ! htmlElement.attributes( "target" ).specified )
{
var href = htmlElement.href;
var target = "_blank";
if ( href.match( this.mInternalLinkRegExp ) != null )
target = "_self";
htmlElement.target = target;
}
}
var outerHTML = htmlElement.outerHTML;
var attributes = "";
var attrStart = outerHTML.indexOf( " " );
var attrClose = outerHTML.indexOf( ">" );
if ( attrStart > 0 && attrStart < attrClose )
{
attributes = outerHTML.substring( attrStart, attrClose );
attributes = attributes.replace( this.mNonQuotedAttributes, '="$1$2"' );
}
if ( htmlElement.hasChildNodes() )
{
sbXhtml.Append( "<" + tagName + attributes + ">" );
var children = htmlElement.childNodes;
var length = children.length;
var child;
for ( var i = 0; i < length; i++ )
{
child = children[ i ];
this.AppendNodeXhtml( child, sbXhtml );
}
if ( tagName == "li" )
{
var nextSibling = htmlElement.nextSibling;
if ( nextSibling != null && nextSibling.tagName != "LI" )
this.AppendNodeXhtml( nextSibling, sbXhtml );
}
sbXhtml.Append( "</" + tagName + ">" );
}
else 
{
switch ( tagName )
{
case "area" :
case "br" :
case "hr" :
case "img" :
case "input" :
case "param":
sbXhtml.Append( "<" + tagName + attributes + "/>" );
break;
case "a"  :
case "button":
case "embed":
case "frame":
case "iframe":
case "li" :
case "map" :
case "object":
case "option":
case "td" :
case "textarea":
case "th" :
case "tr" :                    
sbXhtml.Append( "<" + tagName + attributes + "></" + tagName + ">" );
break;
}
}
htmlElement.cleanerParsed = true;			
break;
case 3:
sbXhtml.Append( XmlEncode(htmlElement.nodeValue, true ) );
break;
}
}
HtmlCleaner.prototype.CleanAttributes = _HtmlCleaner_CleanAttributes;
function _HtmlCleaner_CleanAttributes( match, tag, attributes )
{
var i, attributeHtml, name, value, p, regMatches;
var arrAttributesHtml = new Array();
var htmlCleaner = HtmlCleaner.Current;
regMatches = attributes.match( htmlCleaner.mAllowedQuotedAttributesRegExp );
if ( regMatches != null )
arrAttributesHtml = regMatches;
regMatches = attributes.match( htmlCleaner.mAllowedNonQuotedAttributesRegExp );
if ( regMatches != null )
arrAttributesHtml = arrAttributesHtml.concat( regMatches );
var quotesRegExp = new RegExp( '"', 'gim' );
for ( i = 0; i < arrAttributesHtml.length; i++ )
{  
attributeHtml = arrAttributesHtml[ i ];
attributeHtml = attributeHtml.replace( quotesRegExp, "" );
p = attributeHtml.indexOf( "=" );
name = attributeHtml.substring( 1, p );
value = attributeHtml.substring( p + 1 );
switch( name )
{
case "style" :
if ( htmlCleaner.mAllowedStyles != "*" )
{
if ( tag.toLowerCase() != "<p" )
regMatches = value.match( htmlCleaner.mAllowedStylesRegExp );
else
regMatches = value.match( htmlCleaner.mAllowedParagraphStylesRegExp );
if ( regMatches == null )
arrAttributesHtml[ i ] = null;
else
arrAttributesHtml[ i ] = ' style="' + regMatches.join( "" ) + '"';
}
break;
case "class" :
value = value.toLowerCase();
if ( htmlCleaner.mAllowedClasses != "*" && !InList( htmlCleaner.mAllowedClasses, value ) )
arrAttributesHtml[ i ] = null;
break;
}
}
return tag + arrAttributesHtml.join( '' ) + ">";
}
HtmlCleaner.prototype.CleanHtml = _HtmlCleaner_CleanHtml;
function _HtmlCleaner_CleanHtml( html )
{
html = html.replace( this.mInvalidInlineTagsRegExp, "" );
html = html.replace( this.mInvalidBlockTagsRegExp, "$1p$2" );
if ( this.mAllowedAttributes != "*" )
{
if ( this.mAllowedAttributes == "-" )
{
html = html.replace( this.mAttributesRegExp, "$1>" );
}
else
{
HtmlCleaner.Current = this;
html = html.replace( this.mAttributesRegExp, this.CleanAttributes );
}
}
html = html.replace( this.mSuperfluousSpaceRegExp, "" );
return html;			   
}
HtmlCleaner.prototype.FixWord = _HtmlCleaner_FixWord;
function _HtmlCleaner_FixWord( html )
{
html = html.replace( this.mFixUnorderedLists, "<ul><li>$1</li></ul>" );
html = html.replace( new RegExp( "</ul>[\r\n]*<ul>", "gim" ), "" );
return html;
}
HtmlCleaner.prototype.GetInnerXhtml = _HtmlCleaner_GetInnerXhtml;
function _HtmlCleaner_GetInnerXhtml( htmlElement )
{	
var sbXhtml = new StringBuilder();
var children = htmlElement.childNodes;
var length = children.length;
for ( var i = 0; i < length; i++ )
this.AppendNodeXhtml( children[ i ], sbXhtml );
var xhtml = sbXhtml.ToString();
xhtml = xhtml.replace( this.mServerHostRegExp, "" );
xhtml = xhtml.replace( this.mInvalidXhtmlTags, "" );
return xhtml;
}
HtmlCleaner.prototype.SetAllowedAttributes = _HtmlCleaner_SetAllowedAttributes;
function _HtmlCleaner_SetAllowedAttributes( allowedAttributes )
{
allowedAttributes = TrimCommas( allowedAttributes.toLowerCase() );
if ( IsEmpty( allowedAttributes ) )
{
allowedAttributes = "-";
}
else if ( allowedAttributes != "*" && allowedAttributes != "-" )
{              
var strMatch = allowedAttributes.replace( /,/g, "|" );
this.mAllowedQuotedAttributesRegExp = new RegExp( ' (' + strMatch + ')="[^"]+"', "gim" );
this.mAllowedNonQuotedAttributesRegExp = new RegExp( ' (' + strMatch + ')=[^ "]+', "gim" );
}			   
this.mAllowedAttributes = allowedAttributes;
}
HtmlCleaner.prototype.SetAllowedClasses = _HtmlCleaner_SetAllowedClasses;
function _HtmlCleaner_SetAllowedClasses( allowedClasses )
{
allowedClasses = TrimCommas( allowedClasses.toLowerCase() );
if ( IsEmpty( allowedClasses ) )
{
this.mAllowedClasses = "-";
}
else if ( allowedClasses != "*" && allowedClasses != "-" )
{
this.mAllowedClasses = "," + allowedClasses + ",";
}
}
HtmlCleaner.prototype.SetAllowedStyles = _HtmlCleaner_SetAllowedStyles;
function _HtmlCleaner_SetAllowedStyles( allowedStyles )
{
allowedStyles = TrimCommas( allowedStyles.toLowerCase() );
if ( IsEmpty( allowedStyles ) )
{
allowedStyles = "-";
}
else if ( allowedStyles != "*" && allowedStyles != "-" )
{
var strMatch = allowedStyles.replace( /,/g, "|" );
this.mAllowedStylesRegExp = new RegExp( "(" + strMatch + "):[^;]+;?","gim" );
strMatch = strMatch.replace( /width|height/g, "x" );
this.mAllowedParagraphStylesRegExp = new RegExp( "(" + strMatch + "):[^;]+;?","gim" );
}
this.mAllowedStyles = allowedStyles;	
}
HtmlCleaner.prototype.SetAllowedTags = _HtmlCleaner_SetAllowedTags;
function _HtmlCleaner_SetAllowedTags( allowedTags )
{
allowedTags = TrimCommas( allowedTags.toLowerCase() );
if ( IsEmpty( allowedTags ) )
{
allowedTags = "-";
}
else if ( allowedTags != "*" && allowedTags != "-" )
{
var strMatch = allowedTags.replace( /,/gim, "|" );
var allowedTagsRegExp = new RegExp( ",(" + strMatch + "),", "gim" );
strMatch = this.mInlineTags.replace( allowedTagsRegExp, "," );
strMatch = TrimCommas( strMatch );
strMatch = strMatch.replace( /,+/g, "|" );
this.mInvalidInlineTagsRegExp = new RegExp( "</?(?:" + strMatch + ")(>| [^>]*>)", "gim" );
strMatch = this.mBlockTags.replace( allowedTagsRegExp, "," )
strMatch = TrimCommas( strMatch );
strMatch = strMatch.replace( /,+/g, "|" );
this.mInvalidBlockTagsRegExp = new RegExp( "(</?)(?:" + strMatch + ")(>| [^>]*>)", "gim" );
}
this.mAllowedTags = allowedTags;	            			   
}
function HttpChannel()
{
}
HttpChannel.prototype.AsyncRequest = _HttpChannel_AsyncRequest;
function _HttpChannel_AsyncRequest( scriptUrl, callbackObject )
{
if ( scriptUrl == null || scriptUrl.length == 0 )
return null;
scriptUrl = AddTimeStampToUrl( scriptUrl );
var xmlHttp = GetXmlHttp();
xmlHttp.open( "GET", scriptUrl, true );
if ( callbackObject != null )
{
callbackObject.xmlHTTP = xmlHttp;
xmlHttp.onreadystatechange = callbackObject.Execute;
}
xmlHttp.send( null );
}
HttpChannel.prototype.Request = _HttpChannel_Request;
function _HttpChannel_Request( scriptUrl )
{
if ( scriptUrl == null || scriptUrl.length == 0 )
return null;
scriptUrl = AddTimeStampToUrl( scriptUrl );
var xmlHttp = GetXmlHttp();
xmlHttp.open( "GET", scriptUrl, false );
xmlHttp.send( null );
if ( xmlHttp.status == 200 )
{   
var html = xmlHttp.responseText;
if ( html != null )
{
var i = html.lastIndexOf( "<!-- Lynkx" );
if ( i > 1 )
html = html.substr( 0, i - 1 );
}
}
else
{
alert( "Er is een applicatie fout opgetreden bij het verwerken van de gegevens, neem contact op met de Liones helpdesk." );
html = '';
}
return html; 
}
HttpChannel.prototype.Submit = _HttpChannel_Submit;
function _HttpChannel_Submit( scriptUrl, postDictionary )
{
if ( scriptUrl == null || scriptUrl.length == 0 )
return null;
scriptUrl = AddTimeStampToUrl( scriptUrl );
var postRequest = '';
if ( postDictionary != null )
{
var key = '';
for( key in postDictionary ) 
{
postRequest += '&' + key + '=' + encodeURIComponent( postDictionary[ key ] );
}
if ( postRequest != '' )
postRequest = postRequest.substr( 1 );
}
var xmlHttp = GetXmlHttp();
xmlHttp.open( "POST", scriptUrl, false );
xmlHttp.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
xmlHttp.send( postRequest );
var html = xmlHttp.responseText;
if ( html != null )
{
var i = html.lastIndexOf( "<!-- Lynkx" );
if ( i > 1 )
html = html.substr( 0, i - 1 );
}
return html; 
}
function Listener()
{
this.mEventList = new Object();
this.mName = "Listener";
}
Listener.prototype.AddEventHandler = _Listener_AddEventHandler;
function _Listener_AddEventHandler( eventName, handler )
{
if ( this.mEventList[ eventName ] == null )
{
this.mEventList[ eventName ] = new Array();
}
this.mEventList[ eventName ].push( handler );
}
Listener.prototype.Notify = _Listener_Notify;
function _Listener_Notify( eventName, eventInfo )
{
if ( this.mEventList[ eventName ] != null )
{	
var handlers = this.mEventList[ eventName ];
var handler;
var length = handlers.length;
for ( var i = 0; i < length; i++ )
{
handler = handlers[ i ];
if ( handler[ 'On' + eventName ] != null )
{	
try 
{
eval( 'handler.On' + eventName + '( eventInfo );' );
}
catch ( e )
{	
alert( e.message + " in: \n" + handler[ 'On' + eventName ] );
}
}
}
}
}
Listener.prototype.Subscribe = _Listener_Subscribe;
function _Listener_Subscribe( publisher )
{
if ( publisher )
publisher.Subscribe( this );
}
function NodeSelection( win )
{
this.mWindow = win;
this.mNodes = new Array();
this.mNodeInfos = new Array();
this.mTypes = new Object();
this.mNumberOfTypes = 0;
this.mOperation = null;
this.mIsInitialized = false;
}
NodeSelection.prototype.AddNode = _NodeSelection_AddNode;
function _NodeSelection_AddNode( nodeInfo )
{
this.mNodeInfos.push( nodeInfo );
}
NodeSelection.prototype.GetOperation = _NodeSelection_GetOperation;
function _NodeSelection_GetOperation()
{
return this.mOperation;
}
NodeSelection.prototype.GetNode = _NodeSelection_GetNode;
function _NodeSelection_GetNode()
{
if ( this.mIsInitialized == false )
this.Initialize();
if ( this.mNodes.length > 0 )
return this.mNodes[ 0 ];
else
return null;
}
NodeSelection.prototype.GetNodes = _NodeSelection_GetNodes;
function _NodeSelection_GetNodes()
{
if ( this.mIsInitialized == false )
this.Initialize();
return this.mNodes;
}
NodeSelection.prototype.GetType = _NodeSelection_GetType;
function _NodeSelection_GetType()
{
if ( this.mIsInitialized == false )
this.Initialize();
if ( this.IsMultiType() )
return null;
if ( this.mNodes.length == 0 )
return null;
return this.mNodes[0].type;
}
NodeSelection.prototype.GetWindow = _NodeSelection_GetWindow;
function _NodeSelection_GetWindow()
{
return this.mWindow;
}
NodeSelection.prototype.Initialize = _NodeSelection_Initialize;
function _NodeSelection_Initialize()
{
var node, i;
var length = this.mNodeInfos.length;
for ( i=0; i < length; i++ )
{
node = AssembleNode( this.mNodeInfos[ i ] );
this.mNodes.push( node );
if ( this.mTypes[ node.type ] == null )
{
this.mTypes[ node.type ] = 1;
this.mNumberOfTypes++;
}
else
this.mTypes[ node.type ]++;
}
this.mIsInitialized = true;
}
NodeSelection.prototype.IsMultiNode = _NodeSelection_IsMultiNode;
function _NodeSelection_IsMultiNode()
{
return ( this.mNodeInfos.length > 1 );
}
NodeSelection.prototype.IsMultiType = _NodeSelection_IsMultiType;
function _NodeSelection_IsMultiType( nodeInfo )
{
if ( this.mIsInitialized == false )
this.Initialize();
return ( this.mNumberOfTypes > 1 );
}
NodeSelection.prototype.SetOperation = _NodeSelection_SetOperation;
function _NodeSelection_SetOperation( operation )
{
this.mOperation = operation;
}
function Profiler()
{
this.time = 0;
this.count = 0;
}
Profiler.prototype.Start = _Profiler_Start;
function _Profiler_Start()
{
this.started = (new Date()).getTime();
this.count++;
}
Profiler.prototype.Stop = _Profiler_Stop;
function _Profiler_Stop()
{
this.time += (new Date()).getTime() - this.started;
this.started = 0;
}
Profiler.prototype.Dump = _Profiler_Dump;
function _Profiler_Dump()
{
var avg = Math.round ( 100 * this.time / this.count ) / 100;
alert( 'Execution profile called ' + this.count + ' times. Total time=' + this.time + 'ms. Avg Time=' + avg + 'ms.' );
}
String.prototype.rereplace = function( sRegEx, sValue, sAttribs )
{
if( typeof sAttribs == "undefined" ) 
{
sAttribs = "mgi";
}
var oRegEx = new RegExp(sRegEx);
if( sAttribs.indexOf("m") > -1 ) { oRegEx.multiline = true; }
if( sAttribs.indexOf("g") > -1 ) { oRegEx.global = true; }
if( sAttribs.indexOf("i") > -1 ) { oRegEx.ignoreCase = true; }
return this.replace(oRegEx, sValue);
}
function StringBuilder( string )
{
this.mCache = null;
this.mParts = [];
this.mLength = 0;
if ( string != null )
this.Append( string );				
}
StringBuilder.prototype.Append = _StringBuilder_Append;
function _StringBuilder_Append( string )
{
this.mParts.push( String( string ) );
this.mLength += string.length;
this.mCache = null;
}
StringBuilder.prototype.ToString = _StringBuilder_ToString;
function _StringBuilder_ToString()
{
if ( this.mCache != null )
{
return this.mCache;
}
else
{
var string = this.mParts.join( "" );
this.mCache = string;
this.mParts = [ string ];
return string;
}
}			
StringBuilder.prototype.GetLength = _StringBuilder_GetLength;
function _StringBuilder_GetLength()
{
return this.mLength;
}			
function Trace()
{
this.mIsEnabled = false;
}
Trace.prototype.Disable = _Trace_Disable;
function _Trace_Disable( string )
{
if ( this.mIsEnabled )
{
this.mIsEnabled = false;
this.mElement.innerHTML = '';
this.mElement.style.display = 'none';
this.mElement.style.height = '0px';
}
}
Trace.prototype.Enable = _Trace_Enable;
function _Trace_Enable()
{
this.mElement = document.getElementById( 'TraceWindow' );
if ( !this.mIsEnabled )
{
this.mIsEnabled = true;
this.mElement.style.height = '150px';
this.mElement.style.display = 'block';
}
}
Trace.prototype.Toggle = _Trace_Toggle;
function _Trace_Toggle()
{
if ( this.mIsEnabled )
this.Disable();
else
this.Enable();
}		
Trace.prototype.TraceMessage = _Trace_TraceMessage;
function _Trace_TraceMessage( message, color )
{
if ( this.mIsEnabled )
this.mElement.insertAdjacentHTML( 
'afterBegin', 
'<span style="background-color:' + color + '">' + HtmlEncode( message ) + 
'</span><br><br>' );
}			
function User( name, assignedRoles, assignedRoleIds, typePermissionsCsv, pointer, assignedBackofficeRoleIds )
{
this.mName = name;
this.mPointer = pointer;
if ( assignedRoles != null && typeof assignedRoles == 'string' )
this.mAssignedRoles = assignedRoles.toLowerCase().split(',');
else
this.mAssignedRoles = new Array();
if ( assignedRoleIds != null && typeof assignedRoleIds == 'string' )
this.mAssignedRoleIds = assignedRoleIds.toLowerCase().split(',');
else
this.mAssignedRoleIds = new Array();
if ( assignedBackofficeRoleIds != null && typeof assignedBackofficeRoleIds == 'string' )
this.mAssignedBackofficeRoleIds = assignedBackofficeRoleIds.toLowerCase().split(',');
else
this.mAssignedBackofficeRoleIds = new Array();
this.mPermissions = new Object();
var data = UnpackCSV( typePermissionsCsv );
var type, permissions, operation, permission;
for ( var i = 1; i < data.length; i++ )
{
type = data[ i ][ "type" ];
if ( this.mPermissions[ type ] == null )
this.mPermissions[ type ] = new Object();
permissions = UnpackCSV( data[ i ][ "permissions" ] );
for ( var j = 1; j < permissions.length; j++ )
{
operation = permissions[ j ][ "operation" ];
permission = decodeURIComponent(  permissions[ j ][ "permission" ] );
this.mPermissions[ type ][ operation ] = permission;
}
}
}
User.prototype.GetPermission = _User_GetPermission;
function _User_GetPermission( operation, typeName, node )
{
if ( this.mName == "System" )
return "enabled";   
if ( typeName == null )
typeName = "default";
else
typeName = typeName.toLowerCase();
type = top.typeManager.GetType( typeName );
var permissionSet = null;
if ( this.mPermissions[ typeName ] != null )
permissionSet = this.mPermissions[ typeName ][ operation ];
while ( permissionSet == null && typeName != "default" )
{
type = type.GetBaseType();
if ( type == null )
break;
typeName = type.GetName().toLowerCase();
if ( this.mPermissions[ typeName ] != null )
permissionSet = this.mPermissions[ typeName ][ operation ];
}
if ( permissionSet == null )
return "hidden";
else if ( permissionSet == "enabled" || 
permissionSet == "disabled" ||
permissionSet == "hidden" )
return permissionSet;
else if ( node == null )
return "hidden";
permissionSet = permissionSet.split( ',' );
var length = permissionSet.length;
var permission = "hidden";
var conditions = node.conditions;
for ( var i = 0; i < length; i++ )
{
var newPermission = permissionSet[ i ];
if ( newPermission != "disabled" && 
newPermission != "hidden" )
{
if ( !isNaN( parseInt( newPermission ) ) )
{
if ( node.allowedRoleIds != null )
{
var roleIds = node.allowedRoleIds.split( ',' );
for ( var j = 0; j < roleIds.length; j++ )
if ( roleIds[ j ] == newPermission )
{
newPermission = "enabled";
break;
}
}
}
else if ( conditions != null )
newPermission = conditions[ newPermission ];
}
if ( newPermission == "enabled" )
return "enabled";
else if ( newPermission == "disabled" )
permission = "disabled";
}
return permission;
}
User.prototype.HasAccessTo = _User_HasAccessTo;
function _User_HasAccessTo( node )
{
var roleIds = node.allowedRoleIds;
if ( IsEmpty( roleIds ) || this.mName == "System" )
return true;
roleIds = roleIds.split(',');
var roleIdsLength = roleIds.length;
var userRoleIds = this.mAssignedRoleIds;
var userRoleIdsLength = userRoleIds.length;
if ( roleIdsLength == 0 )
return true;
var found = false;
for ( var i=0; i < roleIdsLength ; i++ )
{
for ( var j=0; j < userRoleIdsLength; j++ )
{
if ( roleIds[ i ] == userRoleIds[ j ] )
{	
found = true;
break;
}
}
if ( found == true )
break;
}
return found;	 
}
User.prototype.HasBackOfficePermission = _User_HasBackOfficePermission;
function _User_HasBackOfficePermission( node )
{
if ( node == null )
{
var nodeSelection = top.current.nodeSelection;
if ( nodeSelection != null )
node = nodeSelection.GetNode();
}
var roleIds = node.allowedRoleIds;
if ( IsEmpty( roleIds ) || this.mName == "System" )
return true;
roleIds = roleIds.split(',');
var roleIdsLength = roleIds.length;
var userRoleIds = this.mAssignedBackofficeRoleIds;
var userRoleIdsLength = userRoleIds.length;
if ( roleIdsLength == 0 )
return true;
var found = false;
for ( var i=0; i < roleIdsLength ; i++ )
{
for ( var j=0; j < userRoleIdsLength; j++ )
{
if ( roleIds[ i ] == userRoleIds[ j ] )
{	
found = true;
break;
}
}
if ( found == true )
break;
}
return found;	 
}
User.prototype.HasRole = _User_HasRole;
function _User_HasRole( roles )
{
if ( IsEmpty( roles ) || this.mName == "System" )
return true;
roles = roles.toLowerCase().split(',');
var rolesLength = roles.length;
var userRoles = this.mAssignedRoles;
var userRolesLength = userRoles.length;
if ( rolesLength == 0 )
return true;
var found = false;
for ( var i=0; i < rolesLength ; i++ )
{
for ( var j=0; j < userRolesLength; j++ )
{
if ( roles[ i ] == userRoles[ j ] )
{	
found = true;
break;
}
}
if ( found == true )
break;
}
return found;
}
function XHistory( currentWindow )
{
this.mUrlStack = new Array();
this.mWindow = currentWindow;
this.mIndex = -1;
}
XHistory.prototype.Add = _XHistory_Add;
function _XHistory_Add( url )
{
if ( url != this.mUrlStack[ this.mIndex ] )
{
if ( this.mIndex < this.mUrlStack.length - 1 )
this.mUrlStack = this.mUrlStack.slice( 0, this.mIndex + 1 );
this.mUrlStack.push( url );
if ( this.mUrlStack.length > 20 )
this.mUrlStack.shift();	
this.mIndex = this.mUrlStack.length - 1;
}
}
XHistory.prototype.Back = _XHistory_Back;
function _XHistory_Back()
{
if ( this.mIndex > 0 )
{
this.mIndex--;
var url = this.mUrlStack[ this.mIndex ];
if ( url != null )
this.mWindow.location = url;
}	
}
XHistory.prototype.Forward = _XHistory_Forward;
function _XHistory_Forward()
{
if ( this.mIndex < this.mUrlStack.length - 1 )
{
this.mIndex++;
var url = this.mUrlStack[ this.mIndex ];
if ( url != null )
this.mWindow.location = url;
}	
}
