function js_beautify(js_source_text,options){var input,output,token_text,last_type,last_text,last_last_text,last_word,flags,flag_store,indent_string;
var whitespace,wordchar,punct,parser_pos,line_starters,digits;
var prefix,token_type,do_block_just_closed;
var wanted_newline,just_added_newline,n_newlines;
options=options?options:{};
var opt_braces_on_own_line=options.braces_on_own_line?options.braces_on_own_line:false;
var opt_indent_size=options.indent_size?options.indent_size:4;
var opt_indent_char=options.indent_char?options.indent_char:" ";
var opt_preserve_newlines=typeof options.preserve_newlines==="undefined"?true:options.preserve_newlines;
var opt_max_preserve_newlines=typeof options.max_preserve_newlines==="undefined"?false:options.max_preserve_newlines;
var opt_indent_level=options.indent_level?options.indent_level:0;
var opt_space_after_anon_function=options.space_after_anon_function==="undefined"?false:options.space_after_anon_function;
var opt_keep_array_indentation=typeof options.keep_array_indentation==="undefined"?false:options.keep_array_indentation;
just_added_newline=false;
var input_length=js_source_text.length;
function trim_output(eat_newlines){eat_newlines=typeof eat_newlines==="undefined"?false:eat_newlines;
while(output.length&&(output[output.length-1]===" "||output[output.length-1]===indent_string||(eat_newlines&&(output[output.length-1]==="\n"||output[output.length-1]==="\r")))){output.pop()
}}function trim(s){return s.replace(/^\s\s*|\s\s*$/,"")
}function print_newline(ignore_repeated){flags.eat_next_space=false;
if(opt_keep_array_indentation&&is_array(flags.mode)){return
}ignore_repeated=typeof ignore_repeated==="undefined"?true:ignore_repeated;
flags.if_line=false;
trim_output();
if(!output.length){return
}if(output[output.length-1]!=="\n"||!ignore_repeated){just_added_newline=true;
output.push("\n")
}for(var i=0;
i<flags.indentation_level;
i+=1){output.push(indent_string)
}if(flags.var_line&&flags.var_line_reindented){if(opt_indent_char===" "){output.push("    ")
}else{output.push(indent_string)
}}}function print_single_space(){if(flags.eat_next_space){flags.eat_next_space=false;
return
}var last_output=" ";
if(output.length){last_output=output[output.length-1]
}if(last_output!==" "&&last_output!=="\n"&&last_output!==indent_string){output.push(" ")
}}function print_token(){just_added_newline=false;
flags.eat_next_space=false;
output.push(token_text)
}function indent(){flags.indentation_level+=1
}function remove_indent(){if(output.length&&output[output.length-1]===indent_string){output.pop()
}}function set_mode(mode){if(flags){flag_store.push(flags)
}flags={previous_mode:flags?flags.mode:"BLOCK",mode:mode,var_line:false,var_line_tainted:false,var_line_reindented:false,in_html_comment:false,if_line:false,in_case:false,eat_next_space:false,indentation_baseline:-1,indentation_level:(flags?flags.indentation_level+((flags.var_line&&flags.var_line_reindented)?1:0):opt_indent_level)}
}function is_array(mode){return mode==="[EXPRESSION]"||mode==="[INDENTED-EXPRESSION]"
}function is_expression(mode){return mode==="[EXPRESSION]"||mode==="[INDENTED-EXPRESSION]"||mode==="(EXPRESSION)"
}function restore_mode(){do_block_just_closed=flags.mode==="DO_BLOCK";
if(flag_store.length>0){flags=flag_store.pop()
}}function in_array(what,arr){for(var i=0;
i<arr.length;
i+=1){if(arr[i]===what){return true
}}return false
}function is_ternary_op(){var level=0,colon_count=0;
for(var i=output.length-1;
i>=0;
i--){switch(output[i]){case":":if(level===0){colon_count++
}break;
case"?":if(level===0){if(colon_count===0){return true
}else{colon_count--
}}break;
case"{":if(level===0){return false
}level--;
break;
case"(":case"[":level--;
break;
case")":case"]":case"}":level++;
break
}}}function get_next_token(){n_newlines=0;
if(parser_pos>=input_length){return["","TK_EOF"]
}wanted_newline=false;
var c=input.charAt(parser_pos);
parser_pos+=1;
var keep_whitespace=opt_keep_array_indentation&&is_array(flags.mode);
if(keep_whitespace){var whitespace_count=0;
while(in_array(c,whitespace)){if(c==="\n"){trim_output();
output.push("\n");
just_added_newline=true;
whitespace_count=0
}else{if(c==="\t"){whitespace_count+=4
}else{if(c==="\r"){}else{whitespace_count+=1
}}}if(parser_pos>=input_length){return["","TK_EOF"]
}c=input.charAt(parser_pos);
parser_pos+=1
}if(flags.indentation_baseline===-1){flags.indentation_baseline=whitespace_count
}if(just_added_newline){var i;
for(i=0;
i<flags.indentation_level+1;
i+=1){output.push(indent_string)
}if(flags.indentation_baseline!==-1){for(i=0;
i<whitespace_count-flags.indentation_baseline;
i++){output.push(" ")
}}}}else{while(in_array(c,whitespace)){if(c==="\n"){n_newlines+=((opt_max_preserve_newlines)?(n_newlines<=opt_max_preserve_newlines)?1:0:1)
}if(parser_pos>=input_length){return["","TK_EOF"]
}c=input.charAt(parser_pos);
parser_pos+=1
}if(opt_preserve_newlines){if(n_newlines>1){for(i=0;
i<n_newlines;
i+=1){print_newline(i===0);
just_added_newline=true
}}}wanted_newline=n_newlines>0
}if(in_array(c,wordchar)){if(parser_pos<input_length){while(in_array(input.charAt(parser_pos),wordchar)){c+=input.charAt(parser_pos);
parser_pos+=1;
if(parser_pos===input_length){break
}}}if(parser_pos!==input_length&&c.match(/^[0-9]+[Ee]$/)&&(input.charAt(parser_pos)==="-"||input.charAt(parser_pos)==="+")){var sign=input.charAt(parser_pos);
parser_pos+=1;
var t=get_next_token(parser_pos);
c+=sign+t[0];
return[c,"TK_WORD"]
}if(c==="in"){return[c,"TK_OPERATOR"]
}if(wanted_newline&&last_type!=="TK_OPERATOR"&&!flags.if_line&&(opt_preserve_newlines||last_text!=="var")){print_newline()
}return[c,"TK_WORD"]
}if(c==="("||c==="["){return[c,"TK_START_EXPR"]
}if(c===")"||c==="]"){return[c,"TK_END_EXPR"]
}if(c==="{"){return[c,"TK_START_BLOCK"]
}if(c==="}"){return[c,"TK_END_BLOCK"]
}if(c===";"){return[c,"TK_SEMICOLON"]
}if(c==="/"){var comment="";
var inline_comment=true;
if(input.charAt(parser_pos)==="*"){parser_pos+=1;
if(parser_pos<input_length){while(!(input.charAt(parser_pos)==="*"&&input.charAt(parser_pos+1)&&input.charAt(parser_pos+1)==="/")&&parser_pos<input_length){c=input.charAt(parser_pos);
comment+=c;
if(c==="\x0d"||c==="\x0a"){inline_comment=false
}parser_pos+=1;
if(parser_pos>=input_length){break
}}}parser_pos+=2;
if(inline_comment){return["/*"+comment+"*/","TK_INLINE_COMMENT"]
}else{return["/*"+comment+"*/","TK_BLOCK_COMMENT"]
}}if(input.charAt(parser_pos)==="/"){comment=c;
while(input.charAt(parser_pos)!=="\r"&&input.charAt(parser_pos)!=="\n"){comment+=input.charAt(parser_pos);
parser_pos+=1;
if(parser_pos>=input_length){break
}}parser_pos+=1;
if(wanted_newline){print_newline()
}return[comment,"TK_COMMENT"]
}}if(c==="'"||c==='"'||(c==="/"&&((last_type==="TK_WORD"&&in_array(last_text,["return","do"]))||(last_type==="TK_COMMENT"||last_type==="TK_START_EXPR"||last_type==="TK_START_BLOCK"||last_type==="TK_END_BLOCK"||last_type==="TK_OPERATOR"||last_type==="TK_EQUALS"||last_type==="TK_EOF"||last_type==="TK_SEMICOLON")))){var sep=c;
var esc=false;
var resulting_string=c;
if(parser_pos<input_length){if(sep==="/"){var in_char_class=false;
while(esc||in_char_class||input.charAt(parser_pos)!==sep){resulting_string+=input.charAt(parser_pos);
if(!esc){esc=input.charAt(parser_pos)==="\\";
if(input.charAt(parser_pos)==="["){in_char_class=true
}else{if(input.charAt(parser_pos)==="]"){in_char_class=false
}}}else{esc=false
}parser_pos+=1;
if(parser_pos>=input_length){return[resulting_string,"TK_STRING"]
}}}else{while(esc||input.charAt(parser_pos)!==sep){resulting_string+=input.charAt(parser_pos);
if(!esc){esc=input.charAt(parser_pos)==="\\"
}else{esc=false
}parser_pos+=1;
if(parser_pos>=input_length){return[resulting_string,"TK_STRING"]
}}}}parser_pos+=1;
resulting_string+=sep;
if(sep==="/"){while(parser_pos<input_length&&in_array(input.charAt(parser_pos),wordchar)){resulting_string+=input.charAt(parser_pos);
parser_pos+=1
}}return[resulting_string,"TK_STRING"]
}if(c==="#"){if(output.length===0&&input.charAt(parser_pos)==="!"){resulting_string=c;
while(parser_pos<input_length&&c!="\n"){c=input.charAt(parser_pos);
resulting_string+=c;
parser_pos+=1
}output.push(trim(resulting_string)+"\n");
print_newline();
return get_next_token()
}var sharp="#";
if(parser_pos<input_length&&in_array(input.charAt(parser_pos),digits)){do{c=input.charAt(parser_pos);
sharp+=c;
parser_pos+=1
}while(parser_pos<input_length&&c!=="#"&&c!=="=");
if(c==="#"){}else{if(input.charAt(parser_pos)==="["&&input.charAt(parser_pos+1)==="]"){sharp+="[]";
parser_pos+=2
}else{if(input.charAt(parser_pos)==="{"&&input.charAt(parser_pos+1)==="}"){sharp+="{}";
parser_pos+=2
}}}return[sharp,"TK_WORD"]
}}if(c==="<"&&input.substring(parser_pos-1,parser_pos+3)==="<!--"){parser_pos+=3;
flags.in_html_comment=true;
return["<!--","TK_COMMENT"]
}if(c==="-"&&flags.in_html_comment&&input.substring(parser_pos-1,parser_pos+2)==="-->"){flags.in_html_comment=false;
parser_pos+=2;
if(wanted_newline){print_newline()
}return["-->","TK_COMMENT"]
}if(in_array(c,punct)){while(parser_pos<input_length&&in_array(c+input.charAt(parser_pos),punct)){c+=input.charAt(parser_pos);
parser_pos+=1;
if(parser_pos>=input_length){break
}}if(c==="="){return[c,"TK_EQUALS"]
}else{return[c,"TK_OPERATOR"]
}}return[c,"TK_UNKNOWN"]
}indent_string="";
while(opt_indent_size>0){indent_string+=opt_indent_char;
opt_indent_size-=1
}input=js_source_text;
last_word="";
last_type="TK_START_EXPR";
last_text="";
last_last_text="";
output=[];
do_block_just_closed=false;
whitespace="\n\r\t ".split("");
wordchar="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$".split("");
digits="0123456789".split("");
punct="+ - * / % & ++ -- = += -= *= /= %= == === != !== > < >= <= >> << >>> >>>= >>= <<= && &= | || ! !! , : ? ^ ^= |= ::".split(" ");
line_starters="continue,try,throw,return,var,if,switch,case,default,for,while,break,function".split(",");
flag_store=[];
set_mode("BLOCK");
parser_pos=0;
while(true){var t=get_next_token(parser_pos);
token_text=t[0];
token_type=t[1];
if(token_type==="TK_EOF"){break
}switch(token_type){case"TK_START_EXPR":if(token_text==="["){if(last_type==="TK_WORD"||last_text===")"){if(in_array(last_text,line_starters)){print_single_space()
}set_mode("(EXPRESSION)");
print_token();
break
}if(flags.mode==="[EXPRESSION]"||flags.mode==="[INDENTED-EXPRESSION]"){if(last_last_text==="]"&&last_text===","){if(flags.mode==="[EXPRESSION]"){flags.mode="[INDENTED-EXPRESSION]";
if(!opt_keep_array_indentation){indent()
}}set_mode("[EXPRESSION]");
if(!opt_keep_array_indentation){print_newline()
}}else{if(last_text==="["){if(flags.mode==="[EXPRESSION]"){flags.mode="[INDENTED-EXPRESSION]";
if(!opt_keep_array_indentation){indent()
}}set_mode("[EXPRESSION]");
if(!opt_keep_array_indentation){print_newline()
}}else{set_mode("[EXPRESSION]")
}}}else{set_mode("[EXPRESSION]")
}}else{set_mode("(EXPRESSION)")
}if(last_text===";"||last_type==="TK_START_BLOCK"){print_newline()
}else{if(last_type==="TK_END_EXPR"||last_type==="TK_START_EXPR"||last_type==="TK_END_BLOCK"||last_text==="."){}else{if(last_type!=="TK_WORD"&&last_type!=="TK_OPERATOR"){print_single_space()
}else{if(last_word==="function"){if(opt_space_after_anon_function){print_single_space()
}}else{if(in_array(last_text,line_starters)||last_text==="catch"){print_single_space()
}}}}}print_token();
break;
case"TK_END_EXPR":if(token_text==="]"){if(opt_keep_array_indentation){if(last_text==="}"){remove_indent();
print_token();
restore_mode();
break
}}else{if(flags.mode==="[INDENTED-EXPRESSION]"){if(last_text==="]"){restore_mode();
print_newline();
print_token();
break
}}}}restore_mode();
print_token();
break;
case"TK_START_BLOCK":if(last_word==="do"){set_mode("DO_BLOCK")
}else{set_mode("BLOCK")
}if(opt_braces_on_own_line){if(last_type!=="TK_OPERATOR"){if(last_text=="return"){print_single_space()
}else{print_newline(true)
}}print_token();
indent()
}else{if(last_type!=="TK_OPERATOR"&&last_type!=="TK_START_EXPR"){if(last_type==="TK_START_BLOCK"){print_newline()
}else{print_single_space()
}}else{if(is_array(flags.previous_mode)&&last_text===","){if(last_last_text==="}"){print_single_space()
}else{print_newline()
}}}indent();
print_token()
}break;
case"TK_END_BLOCK":restore_mode();
if(opt_braces_on_own_line){print_newline();
print_token()
}else{if(last_type==="TK_START_BLOCK"){if(just_added_newline){remove_indent()
}else{trim_output()
}}else{if(is_array(flags.mode)&&opt_keep_array_indentation){opt_keep_array_indentation=false;
print_newline();
opt_keep_array_indentation=true
}else{print_newline()
}}print_token()
}break;
case"TK_WORD":if(do_block_just_closed){print_single_space();
print_token();
print_single_space();
do_block_just_closed=false;
break
}if(token_text==="function"){if((just_added_newline||last_text===";")&&last_text!=="{"){n_newlines=just_added_newline?n_newlines:0;
if(!opt_preserve_newlines){n_newlines=1
}for(var i=0;
i<2-n_newlines;
i++){print_newline(false)
}}}if(token_text==="case"||token_text==="default"){if(last_text===":"){remove_indent()
}else{flags.indentation_level--;
print_newline();
flags.indentation_level++
}print_token();
flags.in_case=true;
break
}prefix="NONE";
if(last_type==="TK_END_BLOCK"){if(!in_array(token_text.toLowerCase(),["else","catch","finally"])){prefix="NEWLINE"
}else{if(opt_braces_on_own_line){prefix="NEWLINE"
}else{prefix="SPACE";
print_single_space()
}}}else{if(last_type==="TK_SEMICOLON"&&(flags.mode==="BLOCK"||flags.mode==="DO_BLOCK")){prefix="NEWLINE"
}else{if(last_type==="TK_SEMICOLON"&&is_expression(flags.mode)){prefix="SPACE"
}else{if(last_type==="TK_STRING"){prefix="NEWLINE"
}else{if(last_type==="TK_WORD"){prefix="SPACE"
}else{if(last_type==="TK_START_BLOCK"){prefix="NEWLINE"
}else{if(last_type==="TK_END_EXPR"){print_single_space();
prefix="NEWLINE"
}}}}}}}if(flags.if_line&&last_type==="TK_END_EXPR"){flags.if_line=false
}if(in_array(token_text.toLowerCase(),["else","catch","finally"])){if(last_type!=="TK_END_BLOCK"||opt_braces_on_own_line){print_newline()
}else{trim_output(true);
print_single_space()
}}else{if(in_array(token_text,line_starters)||prefix==="NEWLINE"){if((last_type==="TK_START_EXPR"||last_text==="="||last_text===",")&&token_text==="function"){}else{if(last_text==="return"||last_text==="throw"){print_single_space()
}else{if(last_type!=="TK_END_EXPR"){if((last_type!=="TK_START_EXPR"||token_text!=="var")&&last_text!==":"){if(token_text==="if"&&last_word==="else"&&last_text!=="{"){print_single_space()
}else{print_newline()
}}}else{if(in_array(token_text,line_starters)&&last_text!==")"){print_newline()
}}}}}else{if(is_array(flags.mode)&&last_text===","&&last_last_text==="}"){print_newline()
}else{if(prefix==="SPACE"){print_single_space()
}}}}print_token();
last_word=token_text;
if(token_text==="var"){flags.var_line=true;
flags.var_line_reindented=false;
flags.var_line_tainted=false
}if(token_text==="if"){flags.if_line=true
}if(token_text==="else"){flags.if_line=false
}break;
case"TK_SEMICOLON":print_token();
flags.var_line=false;
flags.var_line_reindented=false;
break;
case"TK_STRING":if(last_type==="TK_START_BLOCK"||last_type==="TK_END_BLOCK"||last_type==="TK_SEMICOLON"){print_newline()
}else{if(last_type==="TK_WORD"){print_single_space()
}}print_token();
break;
case"TK_EQUALS":if(flags.var_line){flags.var_line_tainted=true
}print_single_space();
print_token();
print_single_space();
break;
case"TK_OPERATOR":var space_before=true;
var space_after=true;
if(flags.var_line&&token_text===","&&(is_expression(flags.mode))){flags.var_line_tainted=false
}if(flags.var_line){if(token_text===","){if(flags.var_line_tainted){print_token();
flags.var_line_reindented=true;
flags.var_line_tainted=false;
print_newline();
break
}else{flags.var_line_tainted=false
}}}if(last_text==="return"||last_text==="throw"){print_single_space();
print_token();
break
}if(token_text===":"&&flags.in_case){print_token();
print_newline();
flags.in_case=false;
break
}if(token_text==="::"){print_token();
break
}if(token_text===","){if(flags.var_line){if(flags.var_line_tainted){print_token();
print_newline();
flags.var_line_tainted=false
}else{print_token();
print_single_space()
}}else{if(last_type==="TK_END_BLOCK"&&flags.mode!=="(EXPRESSION)"){print_token();
if(flags.mode==="OBJECT"&&last_text==="}"){print_newline()
}else{print_single_space()
}}else{if(flags.mode==="OBJECT"){print_token();
print_newline()
}else{print_token();
print_single_space()
}}}break
}else{if(in_array(token_text,["--","++","!"])||(in_array(token_text,["-","+"])&&(in_array(last_type,["TK_START_BLOCK","TK_START_EXPR","TK_EQUALS","TK_OPERATOR"])||in_array(last_text,line_starters)))){space_before=false;
space_after=false;
if(last_text===";"&&is_expression(flags.mode)){space_before=true
}if(last_type==="TK_WORD"&&in_array(last_text,line_starters)){space_before=true
}if(flags.mode==="BLOCK"&&(last_text==="{"||last_text===";")){print_newline()
}}else{if(token_text==="."){space_before=false
}else{if(token_text===":"){if(!is_ternary_op()){flags.mode="OBJECT";
space_before=false
}}}}}if(space_before){print_single_space()
}print_token();
if(space_after){print_single_space()
}if(token_text==="!"){}break;
case"TK_BLOCK_COMMENT":var lines=token_text.split(/\x0a|\x0d\x0a/);
if(/^\/\*\*/.test(token_text)){print_newline();
output.push(lines[0]);
for(i=1;
i<lines.length;
i++){print_newline();
output.push(" ");
output.push(trim(lines[i]))
}}else{if(lines.length>1){print_newline();
trim_output()
}else{print_single_space()
}for(i=0;
i<lines.length;
i++){output.push(lines[i]);
output.push("\n")
}}print_newline();
break;
case"TK_INLINE_COMMENT":print_single_space();
print_token();
if(is_expression(flags.mode)){print_single_space()
}else{print_newline()
}break;
case"TK_COMMENT":if(wanted_newline){print_newline()
}else{print_single_space()
}print_token();
print_newline();
break;
case"TK_UNKNOWN":if(last_text==="return"||last_text==="throw"){print_single_space()
}print_token();
break
}last_last_text=last_text;
last_type=token_type;
last_text=token_text
}return output.join("").replace(/[\n ]+$/,"")
}if(typeof exports!=="undefined"){exports.js_beautify=js_beautify
};
function WGGAbstractDetailBox(app,domElement,eventController){this.app=app;
this.domElement=domElement;
this.nativeBox=null;
this.eventController=eventController;
this.initialize()
}WGGAbstractDetailBox.prototype.getNativeDetailBox=function(){return this.nativeBox
};
WGGAbstractDetailBox.prototype.initialize=function(){};
WGGAbstractDetailBox.prototype.update=function(){};
WGGAbstractDetailBox.prototype.registerEvents=function(){};
function WGGAbstractLocationList(app,domElement,eventController){this.app=app;
this.domElement=domElement;
this.nativeList=null;
this.eventController=eventController;
this.initialize()
}WGGAbstractLocationList.prototype.initialize=function(){};
WGGAbstractLocationList.prototype.update=function(subject,action,object){};
WGGAbstractLocationList.prototype.getNativeList=function(){return this.nativeList
};
WGGAbstractLocationList.prototype.registerEvents=function(){};
function WGGAbstractMap(app,domElement,eventController){this.app=app;
this.domElement=domElement;
this.eventController=eventController;
this.nativeMap=null;
this.markersCache=null;
this.route=null;
this.initialize()
}WGGAbstractMap.prototype.getApp=function(){return this.app
};
WGGAbstractMap.prototype.getNativeMap=function(){return this.nativeMap
};
WGGAbstractMap.prototype.initialize=function(){this.initializeNativeMap();
if(this.nativeMap!=null){var config=this.app.getConfig();
if(config.initialExtent&&config.initialExtent!=null){config.initialExtent.addPoint(config.centerPoint);
this.setExtent(config.initialExtent)
}else{this.setCenter(config.centerPoint.getX(),config.centerPoint.getY(),config.scale)
}this.nativeMap.wggNextDoorApp=this.app;
this.markersCache=new WGGHashMap()
}};
WGGAbstractMap.prototype.initializeNativeMap=function(){this.createNativeMapObject();
this.addControls()
};
WGGAbstractMap.prototype.createNativeMapObject=function(){};
WGGAbstractMap.prototype.addControls=function(){};
WGGAbstractMap.prototype.getDomElement=function(){return this.domElement
};
WGGAbstractMap.prototype.computeCoordsFromPx=function(px){return null
};
WGGAbstractMap.prototype.update=function(subject){};
WGGAbstractMap.prototype.setCenter=function(x,y,scale){};
WGGAbstractMap.prototype.getCenter=function(){return null
};
WGGAbstractMap.prototype.getZoom=function(){return null
};
WGGAbstractMap.prototype.panTo=function(x,y){};
WGGAbstractMap.prototype.getMaxScaleLevel=function(){return null
};
WGGAbstractMap.prototype.getExtent=function(){return null
};
WGGAbstractMap.prototype.transform=function(x,y,prjStr){return null
};
WGGAbstractMap.prototype.setExtent=function(extent){};
WGGAbstractMap.prototype.onMarkersAdded=function(){};
WGGAbstractMap.prototype.onAllMarkersShown=function(){};
WGGAbstractMap.prototype.onMapClick=function(e){};
WGGAbstractMap.prototype.onMapMoveEnd=function(e){};
WGGAbstractMap.prototype.getPixelPosition=function(){return WGGGUIUtils.getPosition(this.domElement)
};
WGGAbstractMap.prototype.getPixelDimension=function(){return WGGGUIUtils.getDimension(this.domElement)
};
WGGAbstractMap.prototype.addRoute=function(options){};
WGGAbstractMap.prototype.deleteRoute=function(){};
WGGAbstractMap.prototype.onRouteError=function(){alert("Route could not be calculated")
};
function WGGAbstractMarker(map,index,point,content){this.map=map;
this.point=point;
this.content=content;
this.nativeMarker=null;
this.index=index
}WGGAbstractMarker.prototype.registerEvents=function(){};
WGGAbstractMarker.prototype.getPoint=function(){return this.point
};
WGGAbstractMarker.prototype.getMap=function(){return this.map
};
WGGAbstractMarker.prototype.getMarkerProperties=function(){var markerProperties=this.map.getApp().getConfig().markerProperties[this.index];
if(!markerProperties){throw"markerProperties for "+this.index+" not defined"
}return markerProperties
};
WGGAbstractMarker.prototype.buildIcon=function(){return null
};
WGGAbstractMarker.prototype.setImageUrl=function(url){return null
};
WGGAbstractMarker.prototype.buildTooltipContent=function(){return null
};
WGGAbstractMarker.prototype.showTooltip=function(){};
WGGAbstractMarker.prototype.hideTooltip=function(){};
WGGAbstractMarker.prototype.highlightMarker=function(){};
WGGAbstractMarker.prototype.show=function(){};
WGGAbstractMarker.prototype.destroy=function(){};
WGGAbstractMarker.prototype.onMouseDownLeft=function(){};
WGGAbstractMarker.prototype.onMouseDownRight=function(){};
WGGAbstractMarker.prototype.getPixelPosition=function(){};
function WGGAbstractPrintMap(app,domElement,eventController){this.app=app;
this.domElement=domElement;
this.eventController=eventController;
this.nativeMap=null;
this.initialize()
}WGGAbstractPrintMap.prototype.getApp=function(){return this.app
};
WGGAbstractPrintMap.prototype.getNativeMap=function(){return this.nativeMap
};
WGGAbstractPrintMap.prototype.initialize=function(){this.initializeNativeMap();
if(this.nativeMap!=null){var config=this.app.getConfig();
this.setCenter(config.centerPoint.getX(),config.centerPoint.getY(),config.scale);
this.nativeMap.wggNextDoorApp=this.app;
this.markersCache=new WGGHashMap()
}};
WGGAbstractPrintMap.prototype.initializeNativeMap=function(){this.createNativeMapObject()
};
WGGAbstractPrintMap.prototype.createNativeMapObject=function(){};
WGGAbstractPrintMap.prototype.getDomElement=function(){return this.domElement
};
WGGAbstractPrintMap.prototype.registerEvents=function(){};
WGGAbstractPrintMap.prototype.setCenter=function(x,y,scale){};
WGGAbstractPrintMap.prototype.setExtent=function(extent){};
WGGAbstractPrintMap.prototype.addMarker=function(point,number,properties){};
WGGAbstractPrintMap.prototype.addRoute=function(options){};
WGGAbstractPrintMap.prototype.printBrowser=function(){window.setTimeout("window.print()",3000)
};
function WGGAbstractStuffFactory(){}WGGAbstractStuffFactory.createFactory=function(type){if(type=="native_google"){return new WGGGoogleStuffFactory()
}if(type=="openlayers"){return new WGGOpenLayersStuffFactory()
}if(type=="native_bing"){return new WGGBingStuffFactory()
}if(type=="ol_bing"){return new WGGOpenLayersStuffFactory()
}if(type=="ol_osm"){return new WGGOpenLayersStuffFactory()
}if(type=="ol_wigeomap"){return new WGGOpenLayersStuffFactory()
}if(type=="ol_wigeostreet"){return new WGGOpenLayersStuffFactory()
}return null
};
WGGAbstractStuffFactory.prototype.createModel=function(app,locations){return new WGGNextDoorModel(app,locations)
};
WGGAbstractStuffFactory.prototype.createEventController=function(app,domElements){return new WGGDefaultEventController(app,domElements)
};
WGGAbstractStuffFactory.prototype.createMap=function(){return null
};
WGGAbstractStuffFactory.prototype.createList=function(app,domElement,eventController){return new WGGBackbaseLocationList(app,domElement,eventController)
};
WGGAbstractStuffFactory.prototype.createDetailBox=function(app,domElement,eventController){return new WGGBackbaseDetailBox(app,domElement,eventController)
};
WGGAbstractStuffFactory.prototype.createPrintMap=function(){return null
};
WGGAbstractStuffFactory.prototype.createMarker=function(){return null
};
function WGGAbstractTooltip(marker,content){this.marker=marker;
this.content=content;
this.show()
}WGGAbstractTooltip.prototype.show=function(){};
WGGAbstractTooltip.prototype.destroy=function(){};
function WGGBackbaseDetailBox(app,domElement,eventController){var self=JSINER.extend(this,"WGGAbstractDetailBox");
self.app=app;
self.domElement=domElement;
self.nativeBox=null;
self.eventController=eventController;
self.initialize();
return self
}WGGBackbaseDetailBox.prototype.initialize=function(){if(this.domElement!=null){if(this.domElement.controller||this.domElement._){this.nativeBox=this.domElement._?this.domElement:this.domElement.controller;
this.nativeBox.wggNextDoorApp=this.app
}}};
WGGBackbaseDetailBox.prototype.update=function(subject,action,object){var locations=null;
if(object!=null){if(WGGDataTypeUtils.isFunction(object.getElementsByTagName)){}else{locations=[this.app.getModel().getLocationById(object)]
}}switch(action){case"show":if(!this.nativeBox.getProperty("open")){this.nativeBox.open()
}if(locations!=null){for(var i=0;
i<locations.length;
i++){var location=locations[i];
var oOldTextNode=bb.evaluateSmart("text()",this.nativeBox);
if(oOldTextNode!=null){this.nativeBox.removeChild(oOldTextNode)
}var oNewTextNode=bb.document.createTextNode(location.toString());
this.nativeBox.appendChild(oNewTextNode)
}}break;
default:}};
function WGGBackbaseLocationList(app,domElement,eventController){var self=JSINER.extend(this,"WGGAbstractLocationList");
self.app=app;
self.domElement=domElement;
self.nativeList=null;
self.eventController=eventController;
self.initialize();
return self
}WGGBackbaseLocationList.prototype.initialize=function(){if(this.domElement!=null){if(this.domElement.controller||this.domElement._){this.nativeList=this.domElement._?this.domElement:this.domElement.controller;
this.nativeList.wggNextDoorApp=this.app
}}};
WGGBackbaseLocationList.prototype.update=function(subject,action,object){var locations=null;
if(object!=null){if(WGGDataTypeUtils.isArray(object)){locations=object
}else{if(WGGDataTypeUtils.isObject(object)){locations=new Array();
locations.push(object)
}}}else{locations=subject.getLocations()
}var dataSource=this.nativeList.getProperty("dataSource");
if(dataSource==null){return
}switch(action){case"add":if(locations==null){break
}for(var i=0;
i<locations.length;
i++){var location=locations[i];
var desc=location.getDesc();
var recordTemplate={};
recordTemplate["@id"]=location.getId();
if(WGGDataTypeUtils.isArray(desc)){for(var j=0;
j<desc.length;
j++){recordTemplate["@col"+j]=desc[j]
}}else{if(WGGDataTypeUtils.isObject(desc)){var j=0;
for(var attr in desc){recordTemplate["@col"+j]=desc[attr];
j++
}}}btl.dataSource.actionRequest(dataSource,"create",[recordTemplate])
}break;
case"show":break;
case"clear":var localRecords=this.nativeList.getProperty("localRecords");
for(var id in localRecords){btl.dataSource.actionRequest(dataSource,"delete",[id])
}break
}};
WGGBackbaseLocationList.prototype.registerEvents=function(){if(this.app!=null){if(this.nativeList!=null){this.nativeList.addEventListener("click",this.onListClick,false);
this.nativeList.addEventListener("selectionChanged",this.onListSelectionChanged,false)
}}};
WGGBackbaseLocationList.prototype.onListClick=function(){};
WGGBackbaseLocationList.prototype.onListSelectionChanged=function(){var event=arguments[0];
if(event.type!="selectionChanged"){return
}var appRef=event.target.wggNextDoorApp;
var model=appRef.getModel();
model.notify(model,"show",event.recordId)
};
function WGGBalloonTooltip1(marker,content,options){var self=JSINER.extend(this,"WGGAbstractTooltip");
self.marker=marker;
self.content=content;
self.options=options;
self.tGeoDimension=null;
if(self.options&&self.marker){var map=self.marker.getMap();
var nativeMap=map.getNativeMap();
var fPoint=nativeMap.getLonLatFromPixel(new OpenLayers.Pixel(0,0));
var sPoint=nativeMap.getLonLatFromPixel(new OpenLayers.Pixel(self.options.tPixelDimension[0],self.options.tPixelDimension[1]));
self.tGeoDimension=[Math.abs(sPoint.lon-fPoint.lon),Math.abs(sPoint.lat-fPoint.lat)];
if(WGGBalloonTooltip1.cSegmentClassName!=self.options.cSegmentClass){var cssRulesManager=new WGGCssRulesManager(document);
var cssStyleSheets=cssRulesManager.getStyleSheets();
var cssRules=new Array();
var cssProperties=new Array();
for(var k=0;
k<cssStyleSheets.length;
k++){cssRulesManager.getPropertyValue(cssStyleSheets[k].href,"."+self.options.cSegmentClass,"width",cssRules,cssProperties);
cssRulesManager.getPropertyValue(cssStyleSheets[k].href,"."+self.options.cSegmentClass,"height",cssRules,cssProperties);
if(cssRules.length>0){break
}}var cWidth=(cssProperties.length>0)?parseInt(cssProperties[0]):2;
var cHeight=(cssProperties.length>1)?parseInt(cssProperties[1]):2;
self.options.cSegmentPixelDimension=[cWidth,cHeight];
WGGBalloonTooltip1.cSegmentClassName=self.options.cSegmentClass;
WGGBalloonTooltip1.cWidth=cWidth;
WGGBalloonTooltip1.cHeight=cHeight
}self.options.cSegmentPixelDimension=[WGGBalloonTooltip1.cWidth,WGGBalloonTooltip1.cHeight]
}self.olBox=null;
self.createSegmentAnimationHandle=null;
self.createSegmentIteration=0;
self.show();
return self
}WGGBalloonTooltip1.prototype.createConnectionSegment=function(args){var startPoint=args.startPoint;
var cSegmentIndex=args.cSegmentIndex;
var cMultiplicator=args.cMultiplicator;
var element=document.createElement("div");
element.style.position="absolute";
element.style.zIndex=1000;
element.className=this.options.cSegmentClass;
element.style.fontSize="1px";
element.style.lineHeight=0;
var cWidth=this.options.cSegmentPixelDimension[0];
var cHeight=this.options.cSegmentPixelDimension[1];
element.style.width=cWidth+"px";
element.style.height=cHeight+"px";
element.style.top=Math.round(startPoint.y+(cSegmentIndex*cHeight*cMultiplicator.top))+"px";
element.style.left=Math.round(startPoint.x+(cSegmentIndex*cWidth*cMultiplicator.left))+"px";
return element
};
WGGBalloonTooltip1.prototype.createInfoWindow=function(args){var startPoint=args.startPoint;
var mIndex=args.mIndex;
var tPixelWidth=args.tPixelWidth;
var tPixelHeight=args.tPixelHeight;
var computeRelInfoWinPosFunctions=[function(tPixelWidth,tPixelHeight,iPixelWidth,iPixelHeight){return{x:Math.abs(tPixelWidth-iPixelWidth),y:0}
},function(tPixelWidth,tPixelHeight,iPixelWidth,iPixelHeight){return{x:0,y:0}
},function(tPixelWidth,tPixelHeight,iPixelWidth,iPixelHeight){return{x:0,y:Math.abs(tPixelHeight-iPixelHeight)}
},function(tPixelWidth,tPixelHeight,iPixelWidth,iPixelHeight){return{x:Math.abs(tPixelWidth-iPixelWidth),y:Math.abs(tPixelHeight-iPixelHeight)}
},];
var element=document.createElement("div");
element.style.position="absolute";
element.style.zIndex=1000;
var cWidth=this.options.cSegmentPixelDimension[0];
var cHeight=this.options.cSegmentPixelDimension[1];
var cSegmentLength=this.options.cSegmentLength;
var iPixelWidth=tPixelWidth-(cSegmentLength*cWidth);
var iPixelHeight=tPixelHeight-(cSegmentLength*cHeight);
var refPoint=computeRelInfoWinPosFunctions[mIndex](tPixelWidth,tPixelHeight,iPixelWidth,iPixelHeight);
element.className=this.options.iWindowClass;
element.style.width=(iPixelWidth-2)+"px";
element.style.height=(iPixelHeight-2)+"px";
element.style.top=refPoint.y+"px";
element.style.left=refPoint.x+"px";
element.innerHTML=this.content;
return element
};
WGGBalloonTooltip1.prototype.onActionPerformed=function(){var newBalloonTooltip=new WGGBalloonTooltip1(this.marker,this.content,this.options)
};
WGGBalloonTooltip1.prototype.show=function(){if(this.marker==null){return
}var map=this.marker.getMap();
var olMap=map.getNativeMap();
olMap.events.register("moveend",this,this.onActionPerformed);
var markerPosition=this.marker.getPixelPosition();
var mapPosition=map.getPixelPosition();
var mapDimension=map.getPixelDimension();
var domElement=map.getDomElement();
var markerProperties=this.marker.getMarkerProperties();
var anchorPoint=new WGGPoint(markerPosition.left-mapPosition.left+markerProperties.locWindowAnchor[0],markerPosition.top-mapPosition.top+markerProperties.locWindowAnchor[1]);
var lonLat=this.marker.nativeMarker.lonlat;
var tGeoWidth=this.tGeoDimension[0];
var tGeoHeight=this.tGeoDimension[1];
var cWidth=this.options.cSegmentPixelDimension[0];
var cHeight=this.options.cSegmentPixelDimension[1];
var cSegmentLength=this.options.cSegmentLength;
var cMultiplicators=[{left:1,top:-1},{left:-1,top:-1},{left:-1,top:1},{left:1,top:1}];
var iMultiplicators=[{left:0,top:-1},{left:-1,top:-1},{left:-1,top:0},{left:0,top:0}];
var computeRelStartPosFunctions=[function(olBox){var div=olBox.div;
return{x:0,y:parseInt(div.style.height)-cHeight}
},function(olBox){var div=olBox.div;
return{x:parseInt(div.style.width)-cWidth,y:parseInt(div.style.height)-cHeight}
},function(olBox){var div=olBox.div;
return{x:parseInt(div.style.width)-cWidth,y:0}
},function(olBox){var div=olBox.div;
return{x:0,y:0}
}];
var lastArea=-1;
var lastBoundingBox=null;
var mIndex=-1;
for(var i=0;
i<4;
i++){var currentArea=-1;
var currentBoundingBox=null;
switch(i){case 0:currentArea=(mapDimension.width-anchorPoint.getX())*anchorPoint.getY();
currentBoundingBox=new OpenLayers.Bounds(lonLat.lon,lonLat.lat,lonLat.lon+tGeoWidth,lonLat.lat+tGeoHeight);
break;
case 1:currentArea=anchorPoint.getX()*anchorPoint.getY();
currentBoundingBox=new OpenLayers.Bounds(lonLat.lon-tGeoWidth,lonLat.lat,lonLat.lon,lonLat.lat+tGeoHeight);
break;
case 2:currentArea=anchorPoint.getX()*(mapDimension.height-anchorPoint.getY());
currentBoundingBox=new OpenLayers.Bounds(lonLat.lon-tGeoWidth,lonLat.lat-tGeoHeight,lonLat.lon,lonLat.lat);
break;
case 3:currentArea=(mapDimension.width-anchorPoint.getX())*(mapDimension.height-anchorPoint.getY());
currentBoundingBox=new OpenLayers.Bounds(lonLat.lon,lonLat.lat-tGeoHeight,lonLat.lon+tGeoWidth,lonLat.lat);
break
}if(lastArea==-1||(currentArea>lastArea)){lastArea=currentArea;
lastBoundingBox=currentBoundingBox;
mIndex=i
}}if(WGGBalloonTooltip1.lastBalloonTooltip!=null){WGGBalloonTooltip1.lastBalloonTooltip.destroy()
}this.olBox=new OpenLayers.Marker.Box(lastBoundingBox,"transparent",1);
var olBoxesLayer=map.getNativeMap().getLayersByName("boxes")[0];
olBoxesLayer.addMarker(this.olBox);
WGGBalloonTooltip1.lastBalloonTooltip=this;
var tPixelWidth=parseInt(this.olBox.div.style.width);
var tPixelHeight=parseInt(this.olBox.div.style.height);
var cMultiplicator=cMultiplicators[mIndex];
var iMultiplicator=iMultiplicators[mIndex];
var startPoint=computeRelStartPosFunctions[mIndex](this.olBox);
var iterations=cSegmentLength+1;
var args={startPoint:startPoint,cSegmentIndex:0,cMultiplicator:cMultiplicator,mIndex:mIndex,tPixelWidth:tPixelWidth,tPixelHeight:tPixelHeight};
this.createSegments(args)
};
WGGBalloonTooltip1.prototype.destroy=function(){var map=this.marker.getMap();
var olMap=map.getNativeMap();
olMap.events.unregister("moveend",this,this.onActionPerformed);
var olBoxesLayer=map.getNativeMap().getLayersByName("boxes")[0];
olBoxesLayer.removeMarker(this.olBox)
};
WGGBalloonTooltip1.prototype.createSegments=function(args){WGGAbstractDebugInterface.gDebugInterface.debug("this.createSegmentIteration: "+this.createSegmentIteration);
this.terminateInsertingSegment();
var cSegmentLength=this.options.cSegmentLength;
if(this.createSegmentIteration==(cSegmentLength+1)){return
}var element=null;
if(this.createSegmentIteration<cSegmentLength){args.cSegmentIndex=this.createSegmentIteration;
WGGAbstractDebugInterface.gDebugInterface.debug(args);
element=this.createConnectionSegment(args)
}else{element=this.createInfoWindow(args)
}this.olBox.div.appendChild(element);
var self=this;
window.setTimeout(function(){self.startInsertingSegment(args)
},50);
this.createSegmentIteration++
};
WGGBalloonTooltip1.prototype.startInsertingSegment=function(args){if(this.createSegmentAnimationHandle!=null){return
}var self=this;
WGGAbstractDebugInterface.gDebugInterface.debug(args);
this.createSegmentAnimationHandle=window.setInterval(function(){self.createSegments(args)
},50)
};
WGGBalloonTooltip1.prototype.terminateInsertingSegment=function(){window.clearInterval(this.createSegmentAnimationHandle);
this.createSegmentAnimationHandle=null
};
WGGBalloonTooltip1.lastBalloonTooltip=null;
WGGBalloonTooltip1.cSegmentClassName=null;
WGGBalloonTooltip1.cWidth=null;
WGGBalloonTooltip1.cHeight=null;
function WGGBingMap(app,domElement,eventController){var self=JSINER.extend(this,"WGGAbstractMap");
self.app=app;
self.domElement=domElement;
self.eventController=eventController;
self.nativeMap=null;
self.markersCache=null;
self.route=null;
self.descriptionDiv=null;
self.initialize();
return self
}WGGBingMap.prototype.createNativeMapObject=function(){if(this.domElement!=null){this.nativeMap=new VEMap(this.domElement.id);
if(this.app.getConfig()!=null&&this.app.getConfig().environment=="PU"){if(this.app.getConfig().applicationID!=null&&this.app.getConfig().applicationID!=""){this.nativeMap.SetCredentials(this.app.getConfig().applicationID)
}else{this.nativeMap.SetClientToken(this.app.getConfig().token)
}}}};
WGGBingMap.prototype.addControls=function(){if(this.nativeMap!=null){this.nativeMap.SetDashboardSize(VEDashboardSize.Normal);
this.nativeMap.LoadMap();
this.nativeMap.HideScalebar();
this.nativeMap.Hide3DNavigationControl();
var printOpt=new VEPrintOptions(true);
this.nativeMap.SetPrintOptions(printOpt)
}};
WGGBingMap.prototype.setCenter=function(x,y,scale){this.nativeMap.SetCenterAndZoom(new VELatLong(y,x),scale)
};
WGGBingMap.prototype.getZoom=function(){var zoom=this.nativeMap.GetZoomLevel();
return zoom
};
WGGBingMap.prototype.panTo=function(x,y){this.nativeMap.PanToLatLong(new VELatLong(y,x))
};
WGGBingMap.prototype.update=function(subject,action,object){if(WGGDataTypeUtils.instanceOf(subject,WGGNextDoorModel)){var factory=WGGAbstractStuffFactory.createFactory(this.app.getConfig().type);
var locations=null;
if(object!=null){if(WGGDataTypeUtils.isArray(object)){locations=object
}else{if(WGGDataTypeUtils.isObject(object)){locations=new Array();
locations.push(object)
}}}else{locations=subject.getLocations()
}switch(action){case"add":if(locations==null){break
}var markerIndex=subject.currentMarkerIndex;
if(markerIndex==null){markerIndex=0
}for(var i=0;
i<locations.length;
i++){var location=locations[i];
if(this.markersCache.get(location.getId())!=null){continue
}var marker=factory.createMarker(this,markerIndex,location,location.getDesc());
this.markersCache.put(location.getId(),marker);
marker.show()
}this.onMarkersAdded();
break;
case"showAll":if(locations==null){break
}if(locations.length==0){break
}var locationLatLong=new Array();
for(var i=0;
i<locations.length;
i++){var location=locations[i];
locationLatLong.push(location.toVELatLong())
}this.nativeMap.SetMapView(locationLatLong);
this.onAllMarkersShown();
break;
case"show":if(object==null){break
}var marker=this.markersCache.get(object);
if(marker!=null){this.setCenter(marker.getPoint().getX(),marker.getPoint().getY(),17);
marker.showTooltip()
}break;
case"clear":if(locations==null){break
}for(var i=0;
i<locations.length;
i++){var recordId=locations[i].getId();
var marker=this.markersCache.get(recordId);
if(marker!=null){marker.destroy()
}}this.markersCache.clear();
break;
case"remove":if(object==null){break
}var recordId=object.getId();
var marker=this.markersCache.get(recordId);
if(marker!=null){marker.destroy()
}this.markersCache.remove(recordId);
break
}}};
WGGBingMap.prototype.getCenter=function(){var c=this.nativeMap.GetCenter();
return new WGGPoint(c.Longitude,c.Latitude)
};
WGGBingMap.prototype.getExtent=function(){if(this.nativeMap==null){return null
}var bounds=this.nativeMap.GetMapView();
var nw=bounds.TopLeftLatLong;
var se=bounds.BottomRightLatLong;
return new WGGExtent(nw.Longitude,se.Latitude,se.Longitude,nw.Latitude)
};
WGGBingMap.prototype.setExtent=function(extent){if(extent==null){return
}var bounds=extent.toBingBounds();
this.nativeMap.SetMapView(bounds)
};
WGGBingMap.prototype.getMaxScaleLevel=function(){return 19
};
WGGBingMap.prototype.registerEvents=function(){if(this.nativeMap!=null){this.onMapClick._bingMapRef=this;
this.nativeMap.AttachEvent("onclick",this.onMapClick);
this.onMapMoveEnd._bingMapRef=this;
this.nativeMap.AttachEvent("onchangeview",this.onMapMoveEnd);
if(this.app.getConfig()!=null&&this.app.getConfig().environment=="PU"){this.nativeMap.AttachEvent("ontokenerror",this.onTokenError);
this.nativeMap.AttachEvent("ontokenexpire",this.onTokenError);
this.nativeMap.AttachEvent("oncredentialserror",this.onCredentialsError)
}}};
WGGBingMap.prototype.onMarkersAdded=function(){};
WGGBingMap.prototype.onAllMarkersShown=function(){};
WGGBingMap.prototype.onMapClick=function(e){if(e.elementID){var _this=(WGGDataTypeUtils.isArray(this))?this[0]:this;
var theShape=_this._bingMapRef.nativeMap.GetShapeByID(e.elementID);
var iterator=_this._bingMapRef.markersCache.keyIterator();
while(iterator.hasNext()){var wggMarker=_this._bingMapRef.markersCache.get(iterator.next());
var bingMarker=wggMarker.nativeMarker;
if(bingMarker==theShape){wggMarker.highlightMarker(e)
}}}};
WGGBingMap.prototype.onMapMoveEnd=function(e){};
WGGBingMap.prototype.onTokenError=function(e){alert("Microsoft Token Error: This error could occur if you use the staging environment and your scale became too large.")
};
WGGBingMap.prototype.onTokenExpired=function(e){alert("Your Session has expired! The Website will be reloaded now");
window.location.reload()
};
WGGBingMap.prototype.onCredentialsError=function(e){alert("You are not authorized to use Bing maps!")
};
WGGBingMap.prototype.addRoute=function(options){if(options!=null&&options.WAYPOINTS){if(this.nativeMap.GetMapStyle()==VEMapStyle.Oblique||this.nativeMap.GetMapStyle()==VEMapStyle.BirdseyeHybrid||this.nativeMap.GetMapStyle()==VEMapStyle.Birdseye){this.nativeMap.SetMapStyle(VEMapStyle.Road)
}var inputWGGLocations=options.WAYPOINTS;
var bingWaypoints=new Array();
for(var i=0;
i<inputWGGLocations.length;
i++){var bingPt=inputWGGLocations[i].toVELatLong();
bingWaypoints[i]=bingPt
}var lng="en";
if(options.LNG){lng=options.LNG
}this.route=new VERouteOptions;
this.route.DrawRoute=true;
this.route.SetBestMapView=true;
if(options.DESCDIV&&options.DESCDIV!=""){this.descriptionDiv=options.DESCDIV;
this.insertRouteDescription._bingMapRef=self;
this.route.RouteCallback=this.insertRouteDescription
}this.nativeMap.GetDirections(bingWaypoints,this.route)
}};
WGGBingMap.prototype.insertRouteDescription=function(route){var contentNode=document.getElementById("routeDiv");
if(contentNode!=null&&route.RouteLegs){for(var i=0;
i<contentNode.childNodes.length;
i++){contentNode.removeChild(contentNode.childNodes[i])
}var tbl=document.createElement("table");
tbl.setAttribute("id","routeTable");
tbl.setAttribute("class","routeList");
tbl.setAttribute("className","routeList");
var tblBody=document.createElement("tbody");
tbl.appendChild(tblBody);
contentNode.appendChild(tbl);
var newRow=tblBody.insertRow(0);
var textNode=document.createTextNode(ILngSource.lng_number);
var cellNode=newRow.insertCell(0);
cellNode.setAttribute("class","routeListHeader");
cellNode.setAttribute("className","routeListHeader");
cellNode.appendChild(textNode);
var textNode=document.createTextNode("");
var cellNode=newRow.insertCell(1);
cellNode.setAttribute("class","routeListHeader");
cellNode.setAttribute("className","routeListHeader");
cellNode.appendChild(textNode);
var textNode=document.createTextNode(ILngSource.lng_yourRoute);
var cellNode=newRow.insertCell(2);
cellNode.setAttribute("class","routeListHeader");
cellNode.setAttribute("className","routeListHeader");
cellNode.appendChild(textNode);
var textNode=document.createTextNode(ILngSource.lng_duration);
var cellNode=newRow.insertCell(3);
cellNode.setAttribute("class","routeListHeader");
cellNode.setAttribute("className","routeListHeader");
cellNode.appendChild(textNode);
var textNode=document.createTextNode(ILngSource.lng_length);
var cellNode=newRow.insertCell(4);
cellNode.setAttribute("class","routeListHeader");
cellNode.setAttribute("className","routeListHeader");
cellNode.appendChild(textNode);
var legs=route.RouteLegs;
var leg=legs[0];
var turn=null;
var legDistance=null;
var startTurn=leg.Itinerary.Items[0];
var endTurn=leg.Itinerary.Items[leg.Itinerary.Items.length-1];
startTurn.Shape.Hide();
endTurn.Shape.Hide();
for(var i=0;
i<leg.Itinerary.Items.length;
i++){turn=leg.Itinerary.Items[i];
var turnNum=i;
var newRow=tblBody.insertRow(tblBody.rows.length);
if(i==0){var textNode=document.createTextNode("")
}else{var textNode=document.createTextNode(turnNum+".")
}var cellNode=newRow.insertCell(0);
cellNode.appendChild(textNode);
var basis=turn.Text;
var wggTCD="";
if(i==0){wggTCD="first"
}else{if((i+1)==leg.Itinerary.Items.length){wggTCD="end"
}else{if(basis.search("roundabout")>-1||basis.search("Kreisverkehr")>-1||basis.search("rotonda")>-1){wggTCD="rdb"
}else{if(basis.search("right")>-1||basis.search("rechts")>-1||basis.search("destra")>-1){wggTCD="right1"
}else{if(basis.search("left")>-1||basis.search("links")>-1||basis.search("sinistra")>-1){wggTCD="left1"
}else{wggTCD="goon"
}}}}}var imgNode=document.createElement("img");
imgNode.setAttribute("src","imgRoute/"+wggTCD+".png");
var cellNode=newRow.insertCell(1);
cellNode.appendChild(imgNode);
var theText=turn.Text;
if(turn.Hints!=null){theText=theText+" ("+turn.Hints[0].Text+")"
}var textNode=document.createTextNode(theText);
var linkNode=document.createElement("a");
linkNode.setAttribute("href","javascript:map.setCenter("+turn.LatLong.Longitude+","+turn.LatLong.Latitude+",map.getMaxScaleLevel());");
linkNode.setAttribute("class","orangeText");
linkNode.setAttribute("className","orangeText");
linkNode.appendChild(textNode);
var cellNode=newRow.insertCell(2);
cellNode.setAttribute("class","orangeText");
cellNode.setAttribute("className","orangeText");
cellNode.appendChild(linkNode);
if((i+1)==leg.Itinerary.Items.length){var zeit=leg.Time
}else{var zeit=turn.Time
}var finalTime="";
if(zeit>60){var min=Math.floor(zeit/60);
if(min>60){var stund=Math.floor(min/60);
min=min-(stund*60);
finalTime=stund+"h "+min+"min"
}else{finalTime=min+" min"
}}else{finalTime=zeit+" sec"
}var textNode=document.createTextNode(finalTime);
var cellNode=newRow.insertCell(3);
if((i+1)==leg.Itinerary.Items.length){cellNode.setAttribute("class","orangeText");
cellNode.setAttribute("className","orangeText")
}cellNode.appendChild(textNode);
if((i+1)==leg.Itinerary.Items.length){var textNode=document.createTextNode(leg.Distance.toFixed(1)+" km");
var cellNode=newRow.insertCell(4);
cellNode.setAttribute("class","orangeText");
cellNode.setAttribute("className","orangeText");
cellNode.appendChild(textNode)
}else{var dis=turn.Distance;
var ganz=Math.floor(dis);
var komma=dis-ganz;
dis=ganz+(Math.round(komma*100)/100);
var textNode=document.createTextNode(dis+" km");
var cellNode=newRow.insertCell(4);
cellNode.appendChild(textNode)
}}}};
WGGBingMap.prototype.deleteRoute=function(){this.nativeMap.DeleteRoute();
this.route=null;
document.getElementById("routeDiv").innerHTML=""
};
WGGBingMap.prototype.onRouteError=function(){return WGGBingMap.superClass.onRouteError.call(this)
};
function WGGBingMarker(map,index,point,content){var self=JSINER.extend(this,"WGGAbstractMarker");
self.map=map;
self.point=point;
self.content=content;
self.nativeMarker=null;
self.index=index;
return self
}WGGBingMarker.prototype.registerEvents=function(){};
WGGBingMarker.prototype.getPixelPosition=function(){throw"not yet implemented"
};
WGGBingMarker.prototype.buildIcon=function(){if(this.map==null){return null
}try{var markerProperties=this.getMarkerProperties();
var icon=new VECustomIconSpecification();
icon.Image=markerProperties.locIconPath;
return icon
}catch(e){throw e
}return null
};
WGGBingMarker.prototype.buildTooltipContent=function(){var myDescription="";
if(WGGDataTypeUtils.isString(this.content)){var myDescription=this.content
}else{if(!WGGDataTypeUtils.isUndefined(this.content.tooltip)){var myDescription=this.content.tooltip
}}return myDescription
};
WGGBingMarker.prototype.showTooltip=function(){};
WGGBingMarker.prototype.hideTooltip=function(){};
WGGBingMarker.prototype.highlightMarker=function(e){return WGGBingMarker.superClass.highlightMarker.call(this)
};
WGGBingMarker.prototype.show=function(){var icon=this.buildIcon();
if(icon!=null){this.nativeMarker=new VEShape(VEShapeType.Pushpin,this.point.toVELatLong());
var markerProperties=this.getMarkerProperties();
this.nativeMarker.SetCustomIcon(icon);
var tt=this.buildTooltipContent();
if(tt!=null){this.nativeMarker.SetDescription(tt)
}this.map.getNativeMap().AddShape(this.nativeMarker)
}};
WGGBingMarker.prototype.destroy=function(){if(this.nativeMarker!=null){this.map.getNativeMap().DeleteShape(this.nativeMarker)
}};
WGGBingMarker.prototype.setImageUrl=function(url){var icon=new VECustomIconSpecification();
icon.Image=url;
this.nativeMarker.SetCustomIcon(icon)
};
function WGGBingPrintMap(app,domElement,eventController){var self=JSINER.extend(this,"WGGAbstractPrintMap");
self.app=app;
self.domElement=domElement;
self.eventController=eventController;
self.nativeMap=null;
self.descriptionDiv=null;
self.initialize();
return self
}WGGBingPrintMap.prototype.createNativeMapObject=function(){if(this.domElement!=null){this.nativeMap=new VEMap(this.domElement.id);
if(this.app.getConfig()!=null&&this.app.getConfig().environment=="PU"){if(this.app.getConfig().applicationID!=null&&this.app.getConfig().applicationID!=""){this.nativeMap.SetCredentials(this.app.getConfig().applicationID)
}else{this.nativeMap.SetClientToken(this.app.getConfig().token)
}}this.nativeMap.SetDashboardSize(VEDashboardSize.Normal);
this.nativeMap.LoadMap();
this.nativeMap.HideScalebar();
this.nativeMap.Hide3DNavigationControl();
var printOpt=new VEPrintOptions(true);
this.nativeMap.SetPrintOptions(printOpt);
this.nativeMap.HideDashboard();
this.nativeMap.AttachEvent("onclick",function(){return true
});
this.nativeMap.AttachEvent("onmouseup",function(){return true
});
this.nativeMap.AttachEvent("onmousedown",function(){return true
});
this.nativeMap.AttachEvent("onmousewheel",function(){return true
});
this.nativeMap.AttachEvent("ondoubleclick",function(){return true
})
}};
WGGBingPrintMap.prototype.setCenter=function(x,y,scale){alert("hier");
this.nativeMap.SetCenterAndZoom(new VELatLong(y,x),scale)
};
WGGBingPrintMap.prototype.setExtent=function(extent){if(extent==null){return
}var bounds=extent.toBingBounds();
this.nativeMap.SetMapView(bounds)
};
WGGBingPrintMap.prototype.onTokenError=function(e){alert("Microsoft Token Error: This error could occur if you use the staging environment and your scale became too large.")
};
WGGBingPrintMap.prototype.onTokenExpired=function(e){alert("Your Session has expired! The Website will be reloaded now");
window.location.reload()
};
WGGBingPrintMap.prototype.addRoute=function(options){if(options!=null&&options.WAYPOINTS){if(this.nativeMap.GetMapStyle()==VEMapStyle.Oblique||this.nativeMap.GetMapStyle()==VEMapStyle.BirdseyeHybrid||this.nativeMap.GetMapStyle()==VEMapStyle.Birdseye){this.nativeMap.SetMapStyle(VEMapStyle.Road)
}var inputWGGLocations=options.WAYPOINTS;
var bingWaypoints=new Array();
for(var i=0;
i<inputWGGLocations.length;
i++){var bingPt=inputWGGLocations[i].toVELatLong();
bingWaypoints[i]=bingPt
}var lng="en";
if(options.LNG){lng=options.LNG
}this.route=new VERouteOptions;
this.route.DrawRoute=true;
this.route.SetBestMapView=true;
if(options.DESCDIV&&options.DESCDIV!=""){this.descriptionDiv=options.DESCDIV;
this.insertRouteDescription._bingMapRef=self;
this.route.RouteCallback=this.insertRouteDescription
}this.nativeMap.GetDirections(bingWaypoints,this.route)
}};
WGGBingPrintMap.prototype.addMarker=function(point,number,markerProperties){var icon=new VECustomIconSpecification();
icon.Image=markerProperties.locIconPath+number+".png";
var nativeMarker=new VEShape(VEShapeType.Pushpin,point.toVELatLong());
nativeMarker.SetCustomIcon(icon)
};
WGGBingPrintMap.prototype.insertRouteDescription=function(route){var contentNode=document.getElementById("routeDiv");
if(contentNode!=null&&route.RouteLegs){for(var i=0;
i<contentNode.childNodes.length;
i++){contentNode.removeChild(contentNode.childNodes[i])
}var tbl=document.createElement("table");
tbl.setAttribute("id","routeTable");
tbl.setAttribute("class","routeList");
tbl.setAttribute("className","routeList");
var tblBody=document.createElement("tbody");
tbl.appendChild(tblBody);
contentNode.appendChild(tbl);
var newRow=tblBody.insertRow(0);
var textNode=document.createTextNode(ILngSource.lng_number);
var cellNode=newRow.insertCell(0);
cellNode.setAttribute("class","routeListHeader");
cellNode.setAttribute("className","routeListHeader");
cellNode.appendChild(textNode);
var textNode=document.createTextNode("");
var cellNode=newRow.insertCell(1);
cellNode.setAttribute("class","routeListHeader");
cellNode.setAttribute("className","routeListHeader");
cellNode.appendChild(textNode);
var textNode=document.createTextNode(ILngSource.lng_yourRoute);
var cellNode=newRow.insertCell(2);
cellNode.setAttribute("class","routeListHeader");
cellNode.setAttribute("className","routeListHeader");
cellNode.appendChild(textNode);
var textNode=document.createTextNode(ILngSource.lng_duration);
var cellNode=newRow.insertCell(3);
cellNode.setAttribute("class","routeListHeader");
cellNode.setAttribute("className","routeListHeader");
cellNode.appendChild(textNode);
var textNode=document.createTextNode(ILngSource.lng_length);
var cellNode=newRow.insertCell(4);
cellNode.setAttribute("class","routeListHeader");
cellNode.setAttribute("className","routeListHeader");
cellNode.appendChild(textNode);
var legs=route.RouteLegs;
var leg=legs[0];
var turn=null;
var legDistance=null;
var startTurn=leg.Itinerary.Items[0];
var endTurn=leg.Itinerary.Items[leg.Itinerary.Items.length-1];
startTurn.Shape.Hide();
endTurn.Shape.Hide();
for(var i=0;
i<leg.Itinerary.Items.length;
i++){turn=leg.Itinerary.Items[i];
var turnNum=i;
var newRow=tblBody.insertRow(tblBody.rows.length);
if(i==0){var textNode=document.createTextNode("")
}else{var textNode=document.createTextNode(turnNum+".")
}var cellNode=newRow.insertCell(0);
cellNode.appendChild(textNode);
var basis=turn.Text;
var wggTCD="";
if(i==0){wggTCD="first"
}else{if((i+1)==leg.Itinerary.Items.length){wggTCD="end"
}else{if(basis.search("roundabout")>-1||basis.search("Kreisverkehr")>-1||basis.search("rotonda")>-1){wggTCD="rdb"
}else{if(basis.search("right")>-1||basis.search("rechts")>-1||basis.search("destra")>-1){wggTCD="right1"
}else{if(basis.search("left")>-1||basis.search("links")>-1||basis.search("sinistra")>-1){wggTCD="left1"
}else{wggTCD="goon"
}}}}}var imgNode=document.createElement("img");
imgNode.setAttribute("src","imgRoute/"+wggTCD+".png");
var cellNode=newRow.insertCell(1);
cellNode.appendChild(imgNode);
var theText=turn.Text;
if(turn.Hints!=null){theText=theText+" ("+turn.Hints[0].Text+")"
}var textNode=document.createTextNode(theText);
var linkNode=document.createElement("a");
linkNode.setAttribute("href","javascript:map.setCenter("+turn.LatLong.Longitude+","+turn.LatLong.Latitude+",map.getMaxScaleLevel());");
linkNode.setAttribute("class","orangeText");
linkNode.setAttribute("className","orangeText");
linkNode.appendChild(textNode);
var cellNode=newRow.insertCell(2);
cellNode.setAttribute("class","orangeText");
cellNode.setAttribute("className","orangeText");
cellNode.appendChild(linkNode);
if((i+1)==leg.Itinerary.Items.length){var zeit=leg.Time
}else{var zeit=turn.Time
}var finalTime="";
if(zeit>60){var min=Math.floor(zeit/60);
if(min>60){var stund=Math.floor(min/60);
min=min-(stund*60);
finalTime=stund+"h "+min+"min"
}else{finalTime=min+" min"
}}else{finalTime=zeit+" sec"
}var textNode=document.createTextNode(finalTime);
var cellNode=newRow.insertCell(3);
if((i+1)==leg.Itinerary.Items.length){cellNode.setAttribute("class","orangeText");
cellNode.setAttribute("className","orangeText")
}cellNode.appendChild(textNode);
if((i+1)==leg.Itinerary.Items.length){var textNode=document.createTextNode(leg.Distance.toFixed(1)+" km");
var cellNode=newRow.insertCell(4);
cellNode.setAttribute("class","orangeText");
cellNode.setAttribute("className","orangeText");
cellNode.appendChild(textNode)
}else{var dis=turn.Distance;
var ganz=Math.floor(dis);
var komma=dis-ganz;
dis=ganz+(Math.round(komma*100)/100);
var textNode=document.createTextNode(dis+" km");
var cellNode=newRow.insertCell(4);
cellNode.appendChild(textNode)
}}}};
function WGGBingStuffFactory(){return JSINER.extend(this,"WGGAbstractStuffFactory")
}WGGBingStuffFactory.prototype.createMap=function(app,domElement,eventController){return new WGGBingMap(app,domElement,eventController)
};
WGGBingStuffFactory.prototype.createPrintMap=function(app,domElement,eventController){return new WGGBingPrintMap(app,domElement,eventController)
};
WGGBingStuffFactory.prototype.createMarker=function(map,index,point,content){return new WGGBingMarker(map,index,point,content)
};
function WGGCustomLocationList(app,domElement,eventController){var self=JSINER.extend(this,"WGGAbstractLocationList");
self.app=app;
self.domElement=domElement;
self.nativeList=null;
self.eventController=eventController;
self.initialize();
return self
}WGGCustomLocationList.prototype.initialize=function(){if(this.domElement!=null){this.nativeList=this.domElement;
this.nativeList.wggNextDoorApp=this.app
}};
function WGGDefaultEventController(app,domElements){this.app=app;
this.domElements=domElements;
this.viewHashMap=null;
this.initialize()
}WGGDefaultEventController.prototype.initialize=function(){if(this.app!=null){if(this.domElements!=null){this.viewHashMap=new WGGHashMap();
for(var type in this.domElements){this.addDomElement(type,this.domElements[type])
}}}};
WGGDefaultEventController.prototype.registerEvents=function(){if(this.app!=null){var entryIterator=this.viewHashMap.entryIterator();
while(entryIterator.hasNext()){var view=entryIterator.next();
if(view!=null){view.registerEvents()
}}}};
WGGDefaultEventController.prototype.getMap=function(){if(this.viewHashMap==null){return null
}return this.viewHashMap.get(WGGDefaultEventController.VIEW_TYPE_MAP)
};
WGGDefaultEventController.prototype.getLocationList=function(){if(this.viewHashMap==null){return null
}return this.viewHashMap.get(WGGDefaultEventController.VIEW_TYPE_LIST)
};
WGGDefaultEventController.prototype.getDetailBox=function(){if(this.viewHashMap==null){return null
}return this.viewHashMap.get(WGGDefaultEventController.VIEW_TYPE_DETAIL)
};
WGGDefaultEventController.prototype.getPrintMap=function(){if(this.viewHashMap==null){return null
}return this.viewHashMap.get(WGGDefaultEventController.VIEW_TYPE_PRINTMAP)
};
WGGDefaultEventController.prototype.addDomElement=function(type,domElement){if(type==null){return
}if(this.viewHashMap.get(type)!=null){return
}if(this.app.getModel().getObserverByProperty("domElement",domElement)!=null){return
}var factory=WGGAbstractStuffFactory.createFactory(this.app.getConfig().type);
var view=null;
switch(type){case WGGDefaultEventController.VIEW_TYPE_MAP:view=factory.createMap(this.app,domElement,this);
break;
case WGGDefaultEventController.VIEW_TYPE_LIST:view=factory.createList(this.app,domElement,this);
break;
case WGGDefaultEventController.VIEW_TYPE_DETAIL:view=factory.createDetailBox(this.app,domElement,this);
break;
case WGGDefaultEventController.VIEW_TYPE_PRINTMAP:view=factory.createPrintMap(this.app,domElement,this);
break;
default:throw"unknown view type '"+type+"'"
}this.viewHashMap.put(type,view);
this.app.getModel().addObserver(view);
this.registerEvents()
};
WGGDefaultEventController.VIEW_TYPE_MAP="MAP";
WGGDefaultEventController.VIEW_TYPE_LIST="LIST";
WGGDefaultEventController.VIEW_TYPE_DETAIL="DETAIL";
WGGDefaultEventController.VIEW_TYPE_PRINTMAP="PRINTMAP";
WGGDefaultEventController.VIEW_TYPES=[WGGDefaultEventController.VIEW_TYPE_MAP,WGGDefaultEventController.VIEW_TYPE_LIST,WGGDefaultEventController.VIEW_TYPE_DETAIL,WGGDefaultEventController.VIEW_TYPE_PRINTMAP];
function WGGGoogleMap(app,domElement,eventController){var self=JSINER.extend(this,"WGGAbstractMap");
self.app=app;
self.domElement=domElement;
self.eventController=eventController;
self.nativeMap=null;
self.markersCache=null;
self.route=null;
self.initialize();
return self
}WGGGoogleMap.prototype.createNativeMapObject=function(){if(this.domElement!=null){this.nativeMap=new GMap2(this.domElement)
}};
WGGGoogleMap.prototype.addControls=function(){if(this.nativeMap!=null){this.nativeMap.addControl(new GLargeMapControl());
this.nativeMap.addControl(new GMapTypeControl());
this.nativeMap.enableDoubleClickZoom();
this.nativeMap.enableContinuousZoom();
this.nativeMap.enableScrollWheelZoom()
}};
WGGGoogleMap.prototype.setCenter=function(x,y,scale){this.nativeMap.setCenter(new GLatLng(y,x),scale)
};
WGGGoogleMap.prototype.getZoom=function(){var zoom=this.nativeMap.getZoom();
return zoom
};
WGGGoogleMap.prototype.panTo=function(x,y){this.nativeMap.panTo(new GLatLng(y,x))
};
WGGGoogleMap.prototype.update=function(subject,action,object){if(WGGDataTypeUtils.instanceOf(subject,WGGNextDoorModel)){var factory=WGGAbstractStuffFactory.createFactory(this.app.getConfig().type);
var locations=null;
if(object!=null){if(WGGDataTypeUtils.isArray(object)){locations=object
}else{if(WGGDataTypeUtils.isObject(object)){locations=new Array();
locations.push(object)
}}}else{locations=subject.getLocations()
}switch(action){case"add":if(locations==null){break
}var markerIndex=subject.currentMarkerIndex;
if(markerIndex==null){markerIndex=0
}for(var i=0;
i<locations.length;
i++){var location=locations[i];
if(this.markersCache.get(location.getId())!=null){continue
}var marker=factory.createMarker(this,markerIndex,location,location.getDesc());
this.markersCache.put(location.getId(),marker);
marker.show()
}this.onMarkersAdded();
break;
case"showAll":if(locations==null){break
}if(locations.length==0){break
}var gBounds=null;
for(var i=0;
i<locations.length;
i++){var location=locations[i];
if(gBounds==null){gBounds=new GLatLngBounds(new GLatLng(location.getY(),location.getX()),new GLatLng(location.getY(),location.getX()));
continue
}gBounds.extend(new GLatLng(location.getY(),location.getX()))
}var zoomLevel=this.nativeMap.getBoundsZoomLevel(gBounds);
this.nativeMap.setCenter(gBounds.getCenter(),zoomLevel);
this.onAllMarkersShown();
break;
case"show":if(object==null){break
}var marker=this.markersCache.get(object);
if(marker!=null){this.setCenter(marker.getPoint().getX(),marker.getPoint().getY(),12);
marker.showTooltip()
}break;
case"clear":if(locations==null){break
}for(var i=0;
i<locations.length;
i++){var recordId=locations[i].getId();
var marker=this.markersCache.get(recordId);
if(marker!=null){marker.destroy()
}}this.markersCache.clear();
break;
case"remove":if(object==null){break
}var recordId=object.getId();
var marker=this.markersCache.get(recordId);
if(marker!=null){marker.destroy()
}this.markersCache.remove(recordId);
break
}}};
WGGGoogleMap.prototype.getCenter=function(){var c=this.nativeMap.getCenter();
return new WGGPoint(c.lng(),c.lat())
};
WGGGoogleMap.prototype.getExtent=function(){if(this.nativeMap==null){return null
}var bounds=this.nativeMap.getBounds();
var sw=bounds.getSouthWest();
var ne=bounds.getNorthEast();
return new WGGExtent(sw.lng(),sw.lat(),ne.lng(),ne.lat())
};
WGGGoogleMap.prototype.setExtent=function(extent){if(extent==null){return
}var gBounds=extent.toGLatLngBounds();
var zoomLevel=this.nativeMap.getBoundsZoomLevel(gBounds);
this.nativeMap.setCenter(gBounds.getCenter(),zoomLevel)
};
WGGGoogleMap.prototype.getMaxScaleLevel=function(){return 21
};
WGGGoogleMap.prototype.registerEvents=function(){if(this.nativeMap!=null){var self=this;
GEvent.clearListeners(this.nativeMap,"click");
GEvent.clearListeners(this.nativeMap,"moveend");
GEvent.addListener(this.nativeMap,"click",function(){self.onMapClick.apply(self,arguments)
});
GEvent.addListener(this.nativeMap,"moveend",function(){self.onMapMoveEnd.apply(self,arguments)
})
}};
WGGGoogleMap.prototype.onMarkersAdded=function(){};
WGGGoogleMap.prototype.onAllMarkersShown=function(){};
WGGGoogleMap.prototype.onMapClick=function(e){};
WGGGoogleMap.prototype.onMapMoveEnd=function(e){};
WGGGoogleMap.prototype.addRoute=function(options){if(options!=null&&options.WAYPOINTS){var descDiv=null;
if(options.DESCDIV){descDiv=options.DESCDIV;
for(var i=0;
i<descDiv.childNodes.length;
i++){descDiv.removeChild(descDiv.childNodes[i])
}}this.route=new GDirections(this.nativeMap,descDiv);
var inputWGGLocations=options.WAYPOINTS;
var googleWaypoints=new Array();
for(var i=0;
i<inputWGGLocations.length;
i++){var googlePt=inputWGGLocations[i].toGLatLng();
googleWaypoints[i]=googlePt
}var lng="en";
if(options.LNG){lng=options.LNG
}var googleOptions={locale:lng,getPolyline:true,getSteps:true};
this.route.loadFromWaypoints(googleWaypoints,googleOptions);
GEvent.addListener(this.route,"error",this.onRouteError)
}};
WGGGoogleMap.prototype.deleteRoute=function(){this.route.clear();
this.route=null
};
WGGGoogleMap.prototype.onRouteError=function(){return WGGGoogleMap.superClass.onRouteError.call(this)
};
function WGGGoogleMarker(map,index,point,content){var self=JSINER.extend(this,"WGGAbstractMarker");
self.map=map;
self.point=point;
self.content=content;
self.nativeMarker=null;
self.index=index;
return self
}WGGGoogleMarker.prototype.registerEvents=function(){if(this.nativeMarker!=null){var self=this;
GEvent.addListener(this.nativeMarker,"click",function(){self.highlightMarker(arguments[0])
});
GEvent.addListener(this.nativeMarker,"mouseover",function(){self.showTooltip(arguments[0])
});
GEvent.addListener(this.nativeMarker,"mouseout",function(){self.hideTooltip(arguments[0])
})
}};
WGGGoogleMarker.prototype.getPixelPosition=function(){throw"not yet implemented"
};
WGGGoogleMarker.prototype.buildIcon=function(){if(this.map==null){return null
}try{var markerProperties=this.getMarkerProperties();
var icon=new GIcon();
icon.image=markerProperties.locIconPath;
icon.shadow=markerProperties.locShadowPath;
icon.iconSize=new GSize(markerProperties.locIconSize[0],markerProperties.locIconSize[1]);
icon.shadowSize=new GSize(markerProperties.locShadowSize[0],markerProperties.locShadowSize[1]);
icon.iconAnchor=new GPoint(markerProperties.locIconAnchor[0],markerProperties.locIconAnchor[1]);
icon.infoWindowAnchor=new GPoint(markerProperties.locWindowAnchor[0],markerProperties.locWindowAnchor[1]);
return icon
}catch(e){throw e
}return null
};
WGGGoogleMarker.prototype.buildTooltipContent=function(){var myDescription="";
if(WGGDataTypeUtils.isString(this.content)){var myDescription=this.content
}else{if(!WGGDataTypeUtils.isUndefined(this.content.tooltip)){var myDescription=this.content.tooltip
}}return myDescription
};
WGGGoogleMarker.prototype.showTooltip=function(){var text=this.buildTooltipContent();
this.nativeMarker.openInfoWindowHtml(text,null)
};
WGGGoogleMarker.prototype.hideTooltip=function(){this.nativeMarker.closeInfoWindow()
};
WGGGoogleMarker.prototype.highlightMarker=function(){return WGGGoogleMarker.superClass.highlightMarker.call(this)
};
WGGGoogleMarker.prototype.show=function(){var icon=this.buildIcon();
if(icon!=null){this.nativeMarker=new GMarker(this.point.toGLatLng(),icon);
this.map.getNativeMap().addOverlay(this.nativeMarker);
this.registerEvents()
}};
WGGGoogleMarker.prototype.destroy=function(){if(this.nativeMarker!=null){this.map.getNativeMap().removeOverlay(this.nativeMarker)
}};
WGGGoogleMarker.prototype.setImageUrl=function(url){this.nativeMarker.setImage(url)
};
function WGGGooglePrintMap(app,domElement,eventController){var self=JSINER.extend(this,"WGGAbstractPrintMap");
self.app=app;
self.domElement=domElement;
self.eventController=eventController;
self.nativeMap=null;
self.initialize();
return self
}WGGGooglePrintMap.prototype.createNativeMapObject=function(){if(this.domElement!=null){this.nativeMap=new GMap2(this.domElement);
this.nativeMap.disableDragging();
this.nativeMap.disableDoubleClickZoom();
this.nativeMap.disableContinuousZoom()
}};
WGGGooglePrintMap.prototype.setCenter=function(x,y,scale){this.nativeMap.setCenter(new GLatLng(y,x),scale)
};
WGGGooglePrintMap.prototype.setExtent=function(extent){if(extent==null){return
}var gBounds=extent.toGLatLngBounds();
var zoomLevel=this.nativeMap.getBoundsZoomLevel(gBounds);
this.nativeMap.setCenter(gBounds.getCenter(),zoomLevel)
};
WGGGooglePrintMap.prototype.addMarker=function(point,number,markerProperties){var icon=new GIcon();
icon.image=markerProperties.locIconPath+number+".png";
icon.shadow=markerProperties.locShadowPath;
icon.iconSize=new GSize(markerProperties.locIconSize[0],markerProperties.locIconSize[1]);
icon.shadowSize=new GSize(markerProperties.locShadowSize[0],markerProperties.locShadowSize[1]);
icon.iconAnchor=new GPoint(markerProperties.locIconAnchor[0],markerProperties.locIconAnchor[1]);
icon.infoWindowAnchor=new GPoint(markerProperties.locWindowAnchor[0],markerProperties.locWindowAnchor[1]);
var nativeMarker=new GMarker(point.toGLatLng(),icon);
this.nativeMap.addOverlay(nativeMarker)
};
WGGGooglePrintMap.prototype.addRoute=function(options){if(options!=null&&options.WAYPOINTS){var descDiv=null;
if(options.DESCDIV){descDiv=options.DESCDIV;
for(var i=0;
i<descDiv.childNodes.length;
i++){descDiv.removeChild(descDiv.childNodes[i])
}}this.route=new GDirections(this.nativeMap,descDiv);
var inputWGGLocations=options.WAYPOINTS;
var googleWaypoints=new Array();
for(var i=0;
i<inputWGGLocations.length;
i++){var googlePt=inputWGGLocations[i].toGLatLng();
googleWaypoints[i]=googlePt
}var lng="en";
if(options.LNG){lng=options.LNG
}var googleOptions={locale:lng,getPolyline:true,getSteps:true};
this.route.loadFromWaypoints(googleWaypoints,googleOptions);
GEvent.addListener(this.route,"error",this.onRouteError)
}};
function WGGGoogleStuffFactory(){return JSINER.extend(this,"WGGAbstractStuffFactory")
}WGGGoogleStuffFactory.prototype.createMap=function(app,domElement,eventController){return new WGGGoogleMap(app,domElement,eventController)
};
WGGGoogleStuffFactory.prototype.createPrintMap=function(app,domElement,eventController){return new WGGGooglePrintMap(app,domElement,eventController)
};
WGGGoogleStuffFactory.prototype.createMarker=function(map,index,point,content){return new WGGGoogleMarker(map,index,point,content)
};
function WGGNestedNextDoorApp(args){this.throwException=function(message){var str="";
if(typeof message=="object"){str=message.message
}else{str=message
}var trace="";
try{if(message.fileName){trace+=message.fileName
}if(message.lineNumber){trace+=", row "+message.lineNumber
}if(trace.length>0){trace=" ("+trace+")"
}}catch(e){}throw"{WGGNestedNextDoorApp} "+message+trace
};
if(args==null){this.throwException("args must not be null")
}if(!(args&&typeof args=="object")){this.throwException("args should be of type 'Object'")
}var _appURL=args.appURL;
if(_appURL==null){this.throwException("parameter appURL may not have been defined")
}var _srcTagNameGUI=args.srcTagNameGUI;
if(_srcTagNameGUI==null){this.throwException("parameter srcTagNameGUI may not have been defined")
}var _domElementGUI=args.domElementGUI;
if(_domElementGUI==null){this.throwException("parameter domElementGUI may not have been defined")
}this.GUIPreprocessor=function(xmlDoc,srcTagNameGUI,domElementGUI){this.isIE=this.constructor.outerClass.isIE;
this.xmlDoc=xmlDoc;
this.srcTagNameGUI=srcTagNameGUI;
this.domElementGUI=domElementGUI;
this.possibleNamespaces={xi:"http://www.w3.org/2001/XInclude",b:"http://www.backbase.com/2006/btl",c:"http://www.backbase.com/2006/command",d:"http://www.backbase.com/2006/tdl",e:"http://www.backbase.com/2006/xel",bf:"http://www.backbase.com/2007/forms",f:"http://www.backbase.com/2007/demos/forms",smil:"http://www.w3.org/2005/SMIL21/BasicAnimation",xs:"http://www.w3.org/2001/XMLSchema"};
this.throwException=this.constructor.outerClass.throwException;
this.serializeNode=function(node){try{if(typeof XMLSerializer!="undefined"){var xmlSerializer=new XMLSerializer();
return xmlSerializer.serializeToString(node)
}else{if(node.xml){return node.xml
}else{this.throwException("no serialization of XML supported")
}}}catch(e){this.throwException(e)
}return null
};
this.preprocessGUI=function(){var nodeGUI=null;
var nsPos=this.srcTagNameGUI.indexOf(":");
var isBBTag=(nsPos!=-1);
if(!this.isIE){var self=this;
function CustomNSResolver(prefix){var namespaces=self.possibleNamespaces;
return namespaces[prefix]||null
}var nodeIterator=this.xmlDoc.evaluate(this.srcTagNameGUI,this.xmlDoc,CustomNSResolver,XPathResult.ANY_TYPE,null);
while(foundNode=nodeIterator.iterateNext()){nodeGUI=foundNode;
break
}}else{nodeGUI=this.xmlDoc.selectSingleNode(this.srcTagNameGUI)
}if(nodeGUI==null){this.throwException("node for gui element '"+this.srcTagNameGUI+"' not found. Please check your configuration.")
}var strGUI=this.serializeNode(nodeGUI);
if(isBBTag){if(!bb){this.throwException("srcTagNameGUI '"+this.srcTagNameGUI+" seems to be a Backbase tag. in order to use it in your application you should include the Backbase library")
}bb.command.create(strGUI,this.domElementGUI)
}else{this.domElementGUI.innerHTML=strGUI
}}
};
this.GUIPreprocessor.outerClass=this;
this.isIE=(navigator.userAgent.toLowerCase().indexOf("msie")!=-1);
this.appURL=_appURL;
this.srcTagNameGUI=_srcTagNameGUI;
this.domElementGUI=_domElementGUI;
this.xmlHttp=false;
this.observers=[];
this.addObserver(this);
this.numberScriptsIncluded=0;
this.numberScriptsLoaded=0;
this.processRequest=function(){if(!this.xmlHttp){return null
}try{if(this.xmlHttp.readyState==4){if(this.xmlHttp.status==200){var xmlDoc=(this.xmlHttp.responseXML==null)?this.xmlHttp.responseText:this.xmlHttp.responseXML;
return xmlDoc
}else{this.throwException("there was a problem retrieving the XML data:\n"+this.xmlHttp.statusText)
}}}catch(e){return e
}return null
};
this.convertXMLNode2DOMNode=function(node){var newNode=null;
if(node.nodeType==1){if(node.tagName){newNode=document.createElement(node.tagName)
}else{return null
}}else{if(node.nodeType==3){return document.createTextNode(node.nodeValue)
}else{return null
}}if(node.attributes){for(var i=0;
i<node.attributes.length;
i++){newNode.setAttribute(node.attributes[i].nodeName,node.attributes[i].nodeValue)
}}if(node.childNodes){for(var i=0;
i<node.childNodes.length;
i++){var newChildNode=this.convertXMLNode2DOMNode(node.childNodes[i]);
if(newChildNode!=null){if(this.isIE&&(newNode.tagName=="STYLE"||newNode.tagName=="SCRIPT")){newNode.text=newChildNode.nodeValue
}else{newNode.appendChild(newChildNode)
}}}}return newNode
};
this.extractTagArea=function(input,tagName){var tagAreaPattern=new RegExp("\\<"+tagName+".*\\/\\>|\\<("+tagName+").*?\\>[\\s\\S]*\\<\\/\\1\\>","g");
var tagAreaMatches=[];
while(tagAreaMatch=tagAreaPattern.exec(input)){tagAreaMatches.push(tagAreaMatch[0])
}return tagAreaMatches
};
this.initialize()
}WGGNestedNextDoorApp.prototype.notify=function(){var args=[];
for(var i=0;
i<arguments.length;
i++){args[i]=arguments[i]
}var count=this.observers.length;
for(var i=0;
i<count;
i++){this.observers[i].update.apply(this.observers[i],args)
}};
WGGNestedNextDoorApp.prototype.addObserver=function(observer){if(!observer.update){return false
}if(this.getObserver(observer)==null){this.observers.push(observer);
return true
}return false
};
WGGNestedNextDoorApp.prototype.getObserver=function(observer){if(!observer.update){return null
}var count=this.observers.length;
for(var i=0;
i<count;
i++){if(this.observers[i]==observer){return observer
}}return null
};
WGGNestedNextDoorApp.prototype.removeObserver=function(observer){var count=this.observers.length;
for(var i=0;
i<count;
i++){if(this.observers[i]==observer){switch(i){case 0:this.observers.shift();
break;
case count-1:this.observers.pop();
break;
default:var part1=this.observers.slice(0,i);
var part2=this.observers.slice(i+1);
this.observers=part1.concat(part2);
break
}return true
}}return false
};
WGGNestedNextDoorApp.prototype.initialize=function(){if(window.XMLHttpRequest){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead")
}catch(e){}try{this.xmlHttp=new XMLHttpRequest();
if(this.xmlHttp.overrideMimeType){this.xmlHttp.overrideMimeType("text/xml")
}}catch(e){this.xmlHttp=false;
this.throwException(e)
}}else{if(window.ActiveXObject){try{this.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")
}catch(e){try{this.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")
}catch(ex){this.xmlHttp=false;
this.throwException(ex)
}}}else{this.throwException("AJAX not supported")
}}};
WGGNestedNextDoorApp.prototype.startApp=function(){var url=this.appURL;
var data=null;
var encoding=null;
if(url==null){this.notify();
return false
}if(!this.xmlHttp){this.notify();
return false
}try{if(data!=null){this.xmlHttp.open("POST",url,true);
var contentType="application/x-www-form-urlencoded";
if(encoding!=null){contentType+="; charset="+encoding
}else{}this.xmlHttp.setRequestHeader("Content-Type",contentType)
}else{this.xmlHttp.open("GET",url,true)
}var self=this;
this.xmlHttp.onreadystatechange=function(){var xmlDoc=self.processRequest();
self.notify(xmlDoc)
};
this.xmlHttp.send(data);
return true
}catch(e){this.notify()
}return false
};
WGGNestedNextDoorApp.prototype.update=function(){var self=this;
if(arguments==null){return
}if(arguments.length==0){return
}if(typeof arguments[0]!="object"){return
}var xmlDoc=arguments[0];
if(xmlDoc==null){return
}try{if(typeof xmlDoc.getElementsByTagName=="undefined"){return
}}catch(e){return
}var head=xmlDoc.getElementsByTagName("head");
if(head){head=head[0];
for(var i=0;
i<head.childNodes.length;
i++){var headChild=head.childNodes[i];
if(headChild.nodeType==1){if(headChild.tagName=="title"||headChild.tagName=="meta"){continue
}var newHeadChild=this.convertXMLNode2DOMNode(headChild);
try{if(newHeadChild.src){var lowerSrc=newHeadChild.src.toLowerCase();
if(lowerSrc.indexOf("init.js")!=-1||lowerSrc.indexOf("openlayers.js")!=-1||lowerSrc.indexOf("google")!=-1){if(this.isIE){newHeadChild.onreadystatechange=function(){if(this.readyState=="complete"||this.readyState=="loaded"){if(typeof __wggJsCoreInitialized=="function"){__wggJsCoreInitialized()
}self.numberScriptsLoaded++;
self.preprocessGUI(xmlDoc)
}}
}else{newHeadChild.onload=function(){if(typeof __wggJsCoreInitialized=="function"){__wggJsCoreInitialized()
}self.numberScriptsLoaded++;
self.preprocessGUI(xmlDoc)
}
}this.numberScriptsIncluded++
}}}catch(e){}document.getElementsByTagName("head")[0].appendChild(newHeadChild)
}}}};
WGGNestedNextDoorApp.prototype.preprocessGUI=function(xmlDoc){if(this.numberScriptsIncluded==this.numberScriptsLoaded){var guiPreprocessor=new this.GUIPreprocessor(xmlDoc,this.srcTagNameGUI,this.domElementGUI);
guiPreprocessor.preprocessGUI()
}};
function WGGNextDoorApp(config,domElements){this.config=config;
this.domElements=domElements;
this.debugInterface=null;
this.model=null;
this.controller=null;
this.initialize()
}WGGNextDoorApp.prototype.initialize=function(){try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){this.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){this.debugInterface=new WGGNullDebugInterface()
}var factory=WGGAbstractStuffFactory.createFactory(this.config.type);
this.model=factory.createModel(this,null);
this.controller=factory.createEventController(this,this.domElements)
};
WGGNextDoorApp.prototype.getConfig=function(){return this.config
};
WGGNextDoorApp.prototype.getModel=function(){return this.model
};
WGGNextDoorApp.prototype.getController=function(){return this.controller
};
function WGGNextDoorAppConfig(){};
function WGGNextDoorModel(app,locations){var self=JSINER.extend(this,"WGGSubject");
self.app=app;
self.observers=[];
self.locations=null;
self.verifierURL=null;
self.nextLocatorURL=null;
self.verifierServerRequestClass=null;
self.nextLocatorServerRequestClass=null;
self.currentMarkerIndex=null;
self.initialize(locations);
return self
}WGGNextDoorModel.prototype.initialize=function(locations){this.locations=new WGGArray();
if(locations!=null){for(var i=0;
i<locations.length;
i++){this.locations.add(locations[i])
}}var detectPathFunction=function(url){if(url==null){return null
}return url.match(/^(http(s)\:\/\/)/)?url:WGGHtmlUtils.buildURLFromCurrentPath(url)
};
if(this.app!=null){var config=this.app.getConfig();
this.verifierURL=detectPathFunction(config.verifierURL);
this.nextLocatorURL=detectPathFunction(config.nextLocatorURL);
if(config.verifierServerRequestClass!=null){this.verifierServerRequestClass=config.verifierServerRequestClass
}if(config.nextLocatorServerRequestClass!=null){this.nextLocatorServerRequestClass=config.nextLocatorServerRequestClass
}}};
WGGNextDoorModel.prototype.getLocations=function(){return this.locations.getArray()
};
WGGNextDoorModel.prototype.loadLocations=function(params){var serverRequestQueue=new WGGServerRequestQueue(this,this.locationsLoaded,params);
var config=this.app.getConfig();
if(this.verifierURL!=null&&this.verifierServerRequestClass!=null){var verifier=new this.verifierServerRequestClass(this.verifierURL,new WGGAjaxLoader());
if(config!=null){for(var param in config.verifierOptions){verifier.addParam(param,verifierOptions[param])
}}serverRequestQueue.addServerRequest(verifier)
}if(this.nextLocatorURL!=null&&this.nextLocatorServerRequestClass!=null){var nextLocator=new this.nextLocatorServerRequestClass(this.nextLocatorURL,new WGGAjaxLoader());
if(config!=null){for(var param in config.nextLocatorOptions){nextLocator.addParam(param,config.nextLocatorOptions[param])
}}serverRequestQueue.addServerRequest(nextLocator)
}serverRequestQueue.start()
};
WGGNextDoorModel.prototype.locationsLoaded=function(){if(arguments==null){return
}var arg0=arguments[0];
var locations=arg0.LOCATIONS;
var bZoomToTotalExtent=true;
if(arguments.length>1){arg1=arguments[1];
if(!WGGDataTypeUtils.isUndefined(arg1)){if(!WGGDataTypeUtils.isUndefined(arg1.bZoomToTotalExtent)){bZoomToTotalExtent=arg1.bZoomToTotalExtent
}}}this.addLocations(locations,bZoomToTotalExtent)
};
WGGNextDoorModel.prototype.getLocationById=function(id){if(this.locations==null){return null
}for(var i=0;
i<this.locations.length();
i++){var location=this.locations.get(i);
if(location==null){continue
}if(location.getId()==id){return location
}}return null
};
WGGNextDoorModel.prototype.getLocationByIndex=function(index){if(this.locations==null){return null
}if(this.locations.length()==0){return null
}if(index<0||index>this.locations.length()-1){return null
}return this.locations.get(index)
};
WGGNextDoorModel.prototype.addLocation=function(location,markerIndex){if(location==null){return
}this.currentMarkerIndex=markerIndex;
this.locations.add(location);
this.notify(this,"add",location);
this.currentMarkerIndex=null
};
WGGNextDoorModel.prototype.addLocations=function(locations,bZoomToTotalExtent,markerIndex){if(locations!=null){this.currentMarkerIndex=markerIndex;
for(var i=0;
i<locations.length;
i++){if(this.locations.contains(locations[i])){continue
}this.locations.add(locations[i])
}this.notify(this,"add",locations);
if(bZoomToTotalExtent){this.notify(this,"showAll",locations)
}this.currentMarkerIndex=null
}};
WGGNextDoorModel.prototype.removeLocation=function(location){if(location!=null){this.locations.remove(location);
this.notify(this,"remove",location)
}};
WGGNextDoorModel.prototype.clear=function(){this.notify(this,"clear");
this.locations.reset()
};
WGGNextDoorModel.prototype.getExtent=function(){var arr=this.locations.getArray();
var extent=null;
for(var i=0;
i<arr.length;
i++){var location=arr[i];
if(extent==null){extent=new WGGExtent(location.getX(),location.getY(),location.getX(),location.getY());
continue
}extent.addPoint(location)
}return extent
};
function WGGOpenLayersMap(app,domElement,eventController){var self=JSINER.extend(this,"WGGAbstractMap");
self.app=app;
self.domElement=domElement;
self.eventController=eventController;
self.nativeMap=null;
self.markersCache=null;
self.route=null;
self.initialize();
return self
}WGGOpenLayersMap.prototype.createNativeMapObject=function(){if(this.domElement!=null){if(this.app!=null&&this.app.getConfig().type=="ol_bing"){var bingOptions={units:"m",controls:[]};
this.nativeMap=new OpenLayers.Map(this.domElement.id,bingOptions);
var road=new OpenLayers.Layer.Bing({name:"Road",key:this.app.getConfig().applicationID,type:"Road"});
var hybrid=new OpenLayers.Layer.Bing({name:"Hybrid",key:this.app.getConfig().applicationID,type:"AerialWithLabels"});
var aerial=new OpenLayers.Layer.Bing({name:"Aerial",key:this.app.getConfig().applicationID,type:"Aerial"});
var markerLayer=new OpenLayers.Layer.Markers("markers");
var boxLayer=new OpenLayers.Layer.Boxes("boxes");
this.nativeMap.addLayers([road,hybrid,aerial,markerLayer,boxLayer])
}else{if(this.app!=null&&this.app.getConfig().type=="ol_osm"){var openstreetmapOptions={projection:new OpenLayers.Projection("EPSG:900913"),displayProjection:new OpenLayers.Projection("EPSG:4326"),units:"m",buffer:"2",controls:[]};
this.nativeMap=new OpenLayers.Map(this.domElement.id,openstreetmapOptions);
var mapLayer=new OpenLayers.Layer.OSM();
var markerLayer=new OpenLayers.Layer.Markers("markers");
var boxLayer=new OpenLayers.Layer.Boxes("boxes");
this.nativeMap.addLayers([mapLayer,markerLayer,boxLayer])
}else{if(this.app!=null&&this.app.getConfig().type=="ol_wigeostreet"){var wigeomapOptions={maxExtent:new OpenLayers.Bounds(-2300000,600000,2500000,5000000),maxResolution:"auto",projection:"EPSG:40103",units:"m",controls:[],scales:[25000000,10000000,5000000,3000000,2000000,1000000,500000,105000,45000,20000,10000,7500,5000,2500,1000,500],numZoomLevels:16};
this.nativeMap=new OpenLayers.Map(this.domElement.id,wigeomapOptions);
var mapLayer=new OpenLayers.Layer.WMS("WIGeoStreet",this.getWMSServiceURL(),{layers:"wigeostreet",projection:"+proj=lcc +lat_1=40 +lat_2=60 +lat_0=30 +lon_0=10 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs",displayProjection:"+proj=lcc +lat_1=40 +lat_2=60 +lat_0=30 +lon_0=10 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs",format:"image/png"},{singleTile:true,opacity:0.6,transitionEffect:"resize",ratio:1});
var markerLayer=new OpenLayers.Layer.Markers("markers");
var boxLayer=new OpenLayers.Layer.Boxes("boxes");
this.nativeMap.addLayers([mapLayer,markerLayer,boxLayer])
}else{var wigeomapOptions={projection:"+proj=lcc +lat_1=40 +lat_2=60 +lat_0=30 +lon_0=10 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs",displayProjection:"+proj=lcc +lat_1=40 +lat_2=60 +lat_0=30 +lon_0=10 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs",units:"m",maxResolution:"auto",buffer:"2",scales:[28181179,14290580,7145250,5720000,4650000,2810000,2250000,1135000,552000,282500,113000,56700,28400,11300,5600,2830],numZoomLevels:16,maxExtent:new OpenLayers.Bounds(-2300000,600000,2500000,5000000),isBaseLayer:"true",isFixed:"true",transparent:"true",controls:[]};
this.nativeMap=new OpenLayers.Map(this.domElement.id,wigeomapOptions);
var mapLayer=new OpenLayers.Layer.WMS.Untiled("map",this.getWMSServiceURL(),{LAYERS:"EU40000,EU20000,EU10000,EU8000,EU6000,EU4000,EU3000,EU2000,EU1000,EU500,EU200,EU100,EU50,EU20,EU10,EU5",FORMAT:"image/png",exceptions:"INIMAGE"},{tileSize:new OpenLayers.Size(400,300),singleTile:true,opacity:0.55});
var markerLayer=new OpenLayers.Layer.Markers("markers");
var boxLayer=new OpenLayers.Layer.Boxes("boxes");
this.nativeMap.addLayers([mapLayer,markerLayer,boxLayer])
}}}}};
WGGOpenLayersMap.prototype.getWMSServiceURL=function(){if(this.app!=null&&this.app.getConfig().type=="ol_wigeostreet"){return"http://wigeomappu.wigeogis.com/wms_geoserver.php"
}else{return"http://wigeoapi2.wigeogis.com/wms_wigeomapeu?service=WMS&version=1.3.0&Request=GetMap&SRS=epsg:40103"
}};
WGGOpenLayersMap.prototype.addControls=function(){if(this.nativeMap!=null){var panZoom=new OpenLayers.Control.PanZoomBar();
panZoom.zoomWorldIcon=true;
this.nativeMap.addControl(panZoom);
this.nativeMap.addControl(new OpenLayers.Control.Navigation({documentDrag:true}));
if(this.app.getConfig().type=="ol_bing"){var bingMap=this.nativeMap;
var layerPanel=new OpenLayers.Control.Panel({displayClass:"bingPanel",autoActivate:true});
var hybridButton=new OpenLayers.Control({type:OpenLayers.Control.TYPE_TOOL,displayClass:"hybridButton",eventListeners:{activate:function(){bingMap.setBaseLayer(bingMap.getLayersByName("Hybrid")[0])
}}});
var mapButton=new OpenLayers.Control({type:OpenLayers.Control.TYPE_TOOL,displayClass:"roadButton",eventListeners:{activate:function(){bingMap.setBaseLayer(bingMap.getLayersByName("Road")[0])
}}});
var aerialButton=new OpenLayers.Control({type:OpenLayers.Control.TYPE_TOOL,displayClass:"aerialButton",eventListeners:{activate:function(){bingMap.setBaseLayer(bingMap.getLayersByName("Aerial")[0])
}}});
layerPanel.addControls([mapButton,hybridButton,aerialButton]);
bingMap.addControl(layerPanel);
layerPanel.activateControl(mapButton)
}}};
WGGOpenLayersMap.prototype.computeCoordsFromPx=function(x,y){if(this.nativeMap==null){return null
}var lonLat=this.nativeMap.getLonLatFromViewPortPx(new OpenLayers.Pixel(x,y));
return new WGGPoint(lonLat.lon,lonLat.lat)
};
WGGOpenLayersMap.prototype.transform=function(x,y,prjStr){return WGGOpenLayersMap.transform(x,y,prjStr,this.nativeMap.getProjectionObject())
};
WGGOpenLayersMap.prototype.setCenter=function(x,y,scale){if(!scale){scale=this.nativeMap.getNumZoomLevels()-1
}this.nativeMap.setCenter(new OpenLayers.LonLat(x,y),scale,false,false)
};
WGGOpenLayersMap.prototype.getCenter=function(){var c=this.nativeMap.getCenter();
return new WGGPoint(c.lon,c.lat)
};
WGGOpenLayersMap.prototype.getZoom=function(){var zoom=this.nativeMap.getZoom();
return zoom
};
WGGOpenLayersMap.prototype.panTo=function(x,y){this.nativeMap.panTo(new OpenLayers.LonLat(x,y))
};
WGGOpenLayersMap.prototype.getMaxScaleLevel=function(){if(this.app!=null&&this.app.getConfig().type=="ol_osm"){return 19
}else{if(this.app!=null&&this.app.getConfig().type=="ol_bing"){return 17
}else{return 15
}}};
WGGOpenLayersMap.prototype.update=function(subject,action,object){if(WGGDataTypeUtils.instanceOf(subject,WGGNextDoorModel)){var factory=WGGAbstractStuffFactory.createFactory(this.app.getConfig().type);
var locations=null;
if(object!=null){if(WGGDataTypeUtils.isArray(object)){locations=object
}else{if(WGGDataTypeUtils.isObject(object)){locations=new Array();
locations.push(object)
}}}else{locations=subject.getLocations()
}switch(action){case"add":if(locations==null){break
}var markerIndex=subject.currentMarkerIndex;
if(markerIndex==null){markerIndex=0
}WGGAbstractDebugInterface.gDebugInterface.warn(locations);
WGGAbstractDebugInterface.gDebugInterface.warn(markerIndex);
for(var i=0;
i<locations.length;
i++){var location=locations[i];
WGGAbstractDebugInterface.gDebugInterface.warn(location);
if(this.markersCache.get(location.getId())!=null){WGGAbstractDebugInterface.gDebugInterface.warn("continue!!");
WGGAbstractDebugInterface.gDebugInterface.warn("markersCache");
WGGAbstractDebugInterface.gDebugInterface.warn(this.markersCache);
WGGAbstractDebugInterface.gDebugInterface.warn("location.getId()");
WGGAbstractDebugInterface.gDebugInterface.warn(location.getId());
continue
}var marker=factory.createMarker(this,markerIndex,location,location.getDesc());
WGGAbstractDebugInterface.gDebugInterface.warn("adding "+location.getId());
this.markersCache.put(location.getId(),marker);
marker.show()
}this.onMarkersAdded();
break;
case"showAll":if(locations==null){break
}if(locations.length==0){break
}var gBounds=null;
for(var i=0;
i<locations.length;
i++){var location=locations[i];
if(gBounds==null){gBounds=new OpenLayers.Bounds(location.getX(),location.getY(),location.getX(),location.getY());
continue
}gBounds.extend(location.toOpenLayersLonLat())
}this.nativeMap.zoomToExtent(gBounds);
this.onAllMarkersShown();
break;
case"show":if(object==null){break
}var marker=this.markersCache.get(object);
if(marker!=null){this.setCenter(marker.getPoint().getX(),marker.getPoint().getY(),14);
marker.showTooltip()
}break;
case"clear":if(locations==null){break
}for(var i=0;
i<locations.length;
i++){var recordId=locations[i].getId();
WGGAbstractDebugInterface.gDebugInterface.debug(locations[i]);
WGGAbstractDebugInterface.gDebugInterface.debug("removing "+recordId);
var marker=this.markersCache.get(recordId);
WGGAbstractDebugInterface.gDebugInterface.debug(marker);
if(marker!=null){marker.destroy()
}}this.markersCache.clear();
case"remove":if(locations==null){break
}for(var i=0;
i<locations.length;
i++){var recordId=locations[i].getId();
WGGAbstractDebugInterface.gDebugInterface.debug(locations[i]);
WGGAbstractDebugInterface.gDebugInterface.debug("removing "+recordId);
var marker=this.markersCache.get(recordId);
WGGAbstractDebugInterface.gDebugInterface.debug(marker);
if(marker!=null){marker.destroy()
}}break
}}};
WGGOpenLayersMap.prototype.getExtent=function(){if(this.nativeMap==null){return null
}var bounds=this.nativeMap.getExtent();
var arr=bounds.toArray();
return new WGGExtent(arr[0],arr[1],arr[2],arr[3])
};
WGGOpenLayersMap.prototype.setExtent=function(extent){if(extent==null){return
}var ext=extent.toOpenLayersBounds();
if(this.app.getConfig().type=="ol_bing"){var centerLonLat=ext.getCenterLonLat();
var zoom=this.nativeMap.getZoomForExtent(ext,false);
this.nativeMap.setCenter(centerLonLat,zoom,false,false)
}else{this.nativeMap.zoomToExtent(ext)
}};
WGGOpenLayersMap.prototype.registerEvents=function(){if(this.nativeMap!=null){this.nativeMap.events.register("click",this,this.onMapClick);
this.nativeMap.events.register("moveend",this,this.onMapMoveEnd)
}};
WGGOpenLayersMap.prototype.onMarkersAdded=function(e){};
WGGOpenLayersMap.prototype.onAllMarkersShown=function(){};
WGGOpenLayersMap.prototype.onMapClick=function(e){};
WGGOpenLayersMap.prototype.onMapMoveEnd=function(e){};
WGGOpenLayersMap.prototype.addRoute=function(options){if(options!=null&&options.WAYPOINTS){var routeLayer=new OpenLayers.Layer.Vector("Route",{isFixed:false,geometryType:OpenLayers.Geometry.LineString});
this.nativeMap.addLayer(routeLayer);
this.nativeMap.raiseLayer(routeLayer,-2);
var inputWGGLocations=options.WAYPOINTS;
for(var i=0;
i<inputWGGLocations.length;
i++){options["X"+(i+1)]=inputWGGLocations[i].getX();
options["Y"+(i+1)]=inputWGGLocations[i].getY();
if(!options["L"+(i+1)]){var desc=inputWGGLocations[i].getDesc();
if(desc!=null&&desc.name){options["L"+(i+1)]=encodeURI(desc.name)
}else{options["L"+(i+1)]=""
}}}options.WAYPOINTS="";
if(!options.LNG){options.LNG="EN"
}if(!options.ROUTETYP){options.ROUTETYP="FAST"
}if(!options.WKT){options.WKT=1
}var descDiv=null;
if(options.DESCDIV){descDiv=options.DESCDIV
}options.DESCDIV="";
var layerStyle=null;
if(options.STYLE){layerStyle=options.STYLE
}this.route=new WGGBingRoute(options,routeLayer,layerStyle,descDiv,true,this.onRouteError);
this.route.compute()
}};
WGGOpenLayersMap.prototype.deleteRoute=function(){if(this.route!=null){this.nativeMap.removeLayer(this.route.olVectorLayer);
if(this.route.descriptionDiv!=null){this.route.descriptionDiv.innerHTML=""
}this.route=null
}};
WGGOpenLayersMap.prototype.onRouteError=function(){return WGGOpenLayersMap.superClass.onRouteError.call(this)
};
WGGOpenLayersMap.transform=function(x,y,srcPrjStr,destPrjStr){if(x==null||y==null){return null
}var lonLat=new OpenLayers.LonLat(x,y);
if(WGGDataTypeUtils.isString(srcPrjStr)){srcPrjStr=new OpenLayers.Projection(srcPrjStr)
}if(WGGDataTypeUtils.isString(destPrjStr)){destPrjStr=new OpenLayers.Projection(destPrjStr)
}var transformedLonLoat=lonLat.transform(srcPrjStr,destPrjStr);
var p=new WGGPoint(transformedLonLoat.lon,transformedLonLoat.lat);
p.prj=WGGOpenLayersMap.getPrjKeyByValue(destPrjStr.projCode);
return p
};
WGGOpenLayersMap.projectionMap={WGS84:"EPSG:4326",LAMBERTEU:"+proj=lcc +lat_1=40 +lat_2=60 +lat_0=30 +lon_0=10 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs",LAMBERTAT:"+proj=lcc +lat_1=46 +lat_2=49 +lat_0=48 +lon_0=13.33333333 +x_0=400000 +y_0=400000 +ellps=bessel +towgs84=586,89,468,5.1,1.4,5.4,1.1 +units=m +no_defs",WEBMERCATOR:"EPSG:900913"};
WGGOpenLayersMap.getPrjKeyByValue=function(prjValue){for(var k in WGGOpenLayersMap.projectionMap){if(WGGOpenLayersMap.projectionMap[k]==prjValue){return k
}}return null
};
function WGGOpenLayersMarker(map,index,point,content){var self=JSINER.extend(this,"WGGAbstractMarker");
self.map=map;
self.point=point;
self.content=content;
self.nativeMarker=null;
self.index=index;
return self
}WGGOpenLayersMarker.prototype.registerEvents=function(){if(this.nativeMarker!=null){var self=this;
this.nativeMarker.events.register("click",this.nativeMarker.icon.imageDiv,function(){self.highlightMarker(arguments[0])
});
this.nativeMarker.events.register("mouseover",this.nativeMarker.icon.imageDiv,function(){self.showTooltip(arguments[0])
});
this.nativeMarker.events.register("mouseout",this.nativeMarker.icon.imageDiv,function(){self.hideTooltip(arguments[0])
})
}};
WGGOpenLayersMarker.prototype.getPixelPosition=function(){if(this.nativeMarker!=null&&this.nativeMarker.icon!=null){return WGGGUIUtils.getPosition(this.nativeMarker.icon.imageDiv)
}return null
};
WGGOpenLayersMarker.prototype.buildIcon=function(){if(this.map==null){return null
}try{var markerProperties=this.getMarkerProperties();
var size=new OpenLayers.Size(markerProperties.locIconSize[0],markerProperties.locIconSize[1]);
var offset=new OpenLayers.Pixel(markerProperties.locIconAnchor[0]*(-1),markerProperties.locIconAnchor[1]*(-1));
var icon=new OpenLayers.Icon(markerProperties.locIconPath,size,offset);
return icon
}catch(e){throw e
}return null
};
WGGOpenLayersMarker.prototype.buildTooltipContent=function(){var myDescription="";
if(WGGDataTypeUtils.isString(this.content)){var myDescription=this.content
}else{if(!WGGDataTypeUtils.isUndefined(this.content.tooltip)){var myDescription=this.content.tooltip
}}return myDescription
};
WGGOpenLayersMarker.prototype.showTooltip=function(){var text=this.buildTooltipContent();
var popup=new OpenLayers.Popup.FramedCloud(this.index+"popup",new OpenLayers.LonLat(this.point.getX(),this.point.getY()),new OpenLayers.Size(50,50),text,this.buildIcon(),false);
popup.panMapIfOutOfView=false;
this.map.markersCache.put(this.index+"popup",popup);
this.map.nativeMap.addPopup(popup,true)
};
WGGOpenLayersMarker.prototype.hideTooltip=function(){var popup=map.markersCache.get(this.index+"popup");
this.map.nativeMap.removePopup(popup)
};
WGGOpenLayersMarker.prototype.highlightMarker=function(){return WGGOpenLayersMarker.superClass.highlightMarker.call(this)
};
WGGOpenLayersMarker.prototype.show=function(){var icon=this.buildIcon();
if(icon!=null){var markers=null;
try{markers=this.map.getNativeMap().getLayersByName("markers");
markers=markers[0]
}catch(e){throw"markers must not be null:"+e
}this.nativeMarker=new OpenLayers.Marker(this.point.toOpenLayersLonLat(),icon);
markers.addMarker(this.nativeMarker);
this.registerEvents()
}};
WGGOpenLayersMarker.prototype.destroy=function(){if(this.nativeMarker!=null){var markers=null;
try{markers=this.map.getNativeMap().getLayersByName("markers");
markers=markers[0]
}catch(e){throw"markers must not be null:"+e
}markers.removeMarker(this.nativeMarker);
this.nativeMarker.destroy()
}};
WGGOpenLayersMarker.prototype.setImageUrl=function(url){this.nativeMarker.icon.setUrl(url)
};
function WGGOpenLayersPrintMap(app,domElement,eventController){var self=JSINER.extend(this,"WGGAbstractPrintMap");
self.app=app;
self.domElement=domElement;
self.eventController=eventController;
self.nativeMap=null;
self.initialize();
return self
}WGGOpenLayersPrintMap.prototype.createNativeMapObject=function(){if(this.domElement!=null){if(this.app!=null&&this.app.getConfig().type=="ol_bing"){var bingOptions={units:"m",controls:[]};
this.nativeMap=new OpenLayers.Map(this.domElement.id,bingOptions);
var road=new OpenLayers.Layer.Bing({name:"Road",key:this.app.getConfig().applicationID,type:"Road"});
var markerLayer=new OpenLayers.Layer.Markers("markers");
var boxLayer=new OpenLayers.Layer.Boxes("boxes");
this.nativeMap.addLayers([road,markerLayer,boxLayer])
}else{if(this.app!=null&&this.app.getConfig().type=="ol_osm"){var openstreetmapOptions={projection:new OpenLayers.Projection("EPSG:900913"),displayProjection:new OpenLayers.Projection("EPSG:4326"),maxExtent:new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),maxResolution:156543.0399,units:"m",buffer:"2",isBaseLayer:"true",controls:[]};
this.nativeMap=new OpenLayers.Map(this.domElement.id,openstreetmapOptions);
var mapLayer=new OpenLayers.Layer.OSM.Mapnik("OpenStreetMap");
var markerLayer=new OpenLayers.Layer.Markers("markers");
var boxLayer=new OpenLayers.Layer.Boxes("boxes");
this.nativeMap.addLayers([mapLayer,markerLayer,boxLayer])
}else{var wigeomapOptions={projection:"+proj=lcc +lat_1=40 +lat_2=60 +lat_0=30 +lon_0=10 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs",displayProjection:"+proj=lcc +lat_1=40 +lat_2=60 +lat_0=30 +lon_0=10 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs",units:"m",maxResolution:"auto",buffer:"2",scales:[28181179,14290580,7145250,5720000,4650000,2810000,2250000,1135000,552000,282500,113000,56700,28400,11300,5600,2830],numZoomLevels:16,maxExtent:new OpenLayers.Bounds(-2300000,600000,2500000,5000000),isBaseLayer:"true",isFixed:"true",transparent:"true",controls:[]};
this.nativeMap=new OpenLayers.Map(this.domElement.id,wigeomapOptions);
var mapLayer=new OpenLayers.Layer.WMS.Untiled("map","http://wigeoapi2.wigeogis.com/wms_wigeomapeu?service=WMS&version=1.3.0&Request=GetMap&SRS=epsg:40103",{LAYERS:"EU40000,EU20000,EU10000,EU8000,EU6000,EU4000,EU3000,EU2000,EU1000,EU500,EU200,EU100,EU50,EU20,EU10,EU5",FORMAT:"image/png",exceptions:"INIMAGE"},{tileSize:new OpenLayers.Size(400,300),singleTile:true,opacity:0.55});
var markerLayer=new OpenLayers.Layer.Markers("markers");
var boxLayer=new OpenLayers.Layer.Boxes("boxes");
this.nativeMap.addLayers([mapLayer,markerLayer,boxLayer])
}}}};
WGGOpenLayersPrintMap.prototype.setCenter=function(x,y,scale){if(!scale){scale=this.nativeMap.getNumZoomLevels()-1
}this.nativeMap.setCenter(new OpenLayers.LonLat(x,y),scale,false,false)
};
WGGOpenLayersPrintMap.prototype.setExtent=function(extent){if(extent==null){return
}var ext=extent.toOpenLayersBounds();
if(this.app.getConfig().type=="ol_bing"){var centerLonLat=ext.getCenterLonLat();
var zoom=this.nativeMap.getZoomForExtent(ext,false);
zoom=zoom-1;
this.nativeMap.setCenter(centerLonLat,zoom,false,false)
}else{this.nativeMap.zoomToExtent(ext)
}};
WGGOpenLayersPrintMap.prototype.addMarker=function(point,number,markerProperties){var markers=null;
markers=this.nativeMap.getLayersByName("markers");
markers=markers[0];
var size=new OpenLayers.Size(markerProperties.locIconSize[0],markerProperties.locIconSize[1]);
var offset=new OpenLayers.Pixel(markerProperties.locIconAnchor[0]*(-1),markerProperties.locIconAnchor[1]*(-1));
var icon=new OpenLayers.Icon(markerProperties.locIconPath+number+".png",size,offset);
var nativeMarker=new OpenLayers.Marker(point.toOpenLayersLonLat(),icon);
markers.addMarker(nativeMarker)
};
WGGOpenLayersPrintMap.prototype.addRoute=function(options){if(options!=null&&options.WAYPOINTS){var routeLayer=new OpenLayers.Layer.Vector("Route",{isFixed:false,geometryType:OpenLayers.Geometry.LineString});
this.nativeMap.addLayer(routeLayer);
this.nativeMap.raiseLayer(routeLayer,-3);
var inputWGGLocations=options.WAYPOINTS;
for(var i=0;
i<inputWGGLocations.length;
i++){options["X"+(i+1)]=inputWGGLocations[i].getX();
options["Y"+(i+1)]=inputWGGLocations[i].getY();
if(!options["L"+(i+1)]){var desc=inputWGGLocations[i].getDesc();
if(desc!=null&&desc.name){options["L"+(i+1)]=encodeURI(desc.name)
}else{options["L"+(i+1)]=""
}}}options.WAYPOINTS="";
if(!options.LNG){options.LNG="EN"
}if(!options.ROUTETYP){options.ROUTETYP="FAST"
}if(!options.WKT){options.WKT=1
}var descDiv=null;
if(options.DESCDIV){descDiv=options.DESCDIV
}options.DESCDIV="";
var layerStyle=null;
if(options.STYLE){layerStyle=options.STYLE
}this.route=new WGGBingRoute(options,routeLayer,layerStyle,descDiv,true);
this.route.compute()
}};
function WGGOpenLayersStuffFactory(){WGGOpenLayersPatches.injectMethods();
return JSINER.extend(this,"WGGAbstractStuffFactory")
}WGGOpenLayersStuffFactory.prototype.createMap=function(app,domElement,eventController){return new WGGOpenLayersMap(app,domElement,eventController)
};
WGGOpenLayersStuffFactory.prototype.createPrintMap=function(app,domElement,eventController){return new WGGOpenLayersPrintMap(app,domElement,eventController)
};
WGGOpenLayersStuffFactory.prototype.createMarker=function(map,index,point,content){return new WGGOpenLayersMarker(map,index,point,content)
};
function WGGBingRoute(options,olVectorLayer,layerStyleOptions,descriptionDiv,doProjection,onErrorFunction){this.options=options;
this.olVectorLayer=olVectorLayer;
this.layerStyleOptions=null;
if(!WGGDataTypeUtils.isUndefined(layerStyleOptions)){this.layerStyleOptions=layerStyleOptions
}this.wkt=null;
this.bingRouteRequest=null;
if(!WGGDataTypeUtils.isUndefined(descriptionDiv)){this.descriptionDiv=descriptionDiv
}else{this.descriptionDiv=null
}if(!WGGDataTypeUtils.isUndefined(doProjection)){this.doProjection=doProjection
}else{this.doProjection=false
}if(!WGGDataTypeUtils.isUndefined(onErrorFunction)&&WGGDataTypeUtils.isFunction(onErrorFunction)){this.onErrorFunction=onErrorFunction
}else{this.onErrorFunction=null
}this.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){this.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){this.debugInterface=new WGGNullDebugInterface()
}}WGGBingRoute.prototype.buildURL=function(path){return location.host+path
};
WGGBingRoute.prototype.compute=function(){var serverRequestQueue=new WGGServerRequestQueue(this,this.show);
this.bingRouteRequest=new WGGBingRouteRequest(this.buildURL("/bingapi/routing/routeasxml.php5"),new WGGAjaxLoader());
for(var paramName in this.options){this.bingRouteRequest.addParam(paramName,this.options[paramName])
}serverRequestQueue.addServerRequest(this.bingRouteRequest);
serverRequestQueue.start()
};
WGGBingRoute.prototype.onShown=function(){};
WGGBingRoute.prototype.show=function(){this.wkt=this.bingRouteRequest.getWKT();
var layerStyle=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style["default"]);
if(this.layerStyleOptions){layerStyle=OpenLayers.Util.extend(layerStyle,this.layerStyleOptions)
}else{layerStyle.fillOpacity=0.7;
layerStyle.strokeWidth=5;
layerStyle.strokeOpacity=0.7;
layerStyle.markerOpacity=0.7;
layerStyle.strokeColor="#5457E0"
}this.olVectorLayer.style=layerStyle;
var olLineString=new OpenLayers.Geometry.fromWKT(this.wkt);
this.olVectorLayer.addFeatures(new OpenLayers.Feature.Vector(olLineString));
this.olVectorLayer.map.zoomToExtent(olLineString.getBounds());
if(this.descriptionDiv!=null){if(this.options.LNG){var lngSource=this.getDescriptionLanguageMap(this.options.LNG)
}else{var lngSource=this.getDescriptionLanguageMap("EN")
}for(var i=0;
i<this.descriptionDiv.childNodes.length;
i++){this.descriptionDiv.removeChild(this.descriptionDiv.childNodes[i])
}var contentNode=this.descriptionDiv;
var tbl=document.createElement("table");
tbl.setAttribute("id","routeTable");
tbl.setAttribute("class","routeList");
tbl.setAttribute("className","routeList");
var tblBody=document.createElement("tbody");
tbl.appendChild(tblBody);
contentNode.appendChild(tbl);
var newRow=tblBody.insertRow(0);
var textNode=document.createTextNode(lngSource.NUMBER);
var cellNode=newRow.insertCell(0);
cellNode.setAttribute("class","routeListHeader");
cellNode.setAttribute("className","routeListHeader");
cellNode.appendChild(textNode);
var textNode=document.createTextNode("");
var cellNode=newRow.insertCell(1);
cellNode.setAttribute("class","routeListHeader");
cellNode.setAttribute("className","routeListHeader");
cellNode.appendChild(textNode);
var textNode=document.createTextNode(lngSource.DESC);
var cellNode=newRow.insertCell(2);
cellNode.setAttribute("class","routeListHeader");
cellNode.setAttribute("className","routeListHeader");
cellNode.appendChild(textNode);
var textNode=document.createTextNode(lngSource.DURATION);
var cellNode=newRow.insertCell(3);
cellNode.setAttribute("class","routeListHeaderKmTime");
cellNode.setAttribute("className","routeListHeaderKmTime");
cellNode.appendChild(textNode);
var textNode=document.createTextNode(lngSource.LENGTH);
var cellNode=newRow.insertCell(4);
cellNode.setAttribute("class","routeListHeaderKmTime");
cellNode.setAttribute("className","routeListHeaderKmTime");
cellNode.appendChild(textNode);
var descPoints=this.bingRouteRequest.getLocations();
for(var i=0;
i<descPoints.length;
i++){var newRow=tblBody.insertRow(tblBody.rows.length);
var infoToInsert=descPoints[i].getDesc();
var textNode=document.createTextNode(infoToInsert.SET+".");
var cellNode=newRow.insertCell(0);
cellNode.appendChild(textNode);
var imgNode=document.createElement("img");
imgNode.setAttribute("src","imgRoute/"+infoToInsert.TCD+".png");
var cellNode=newRow.insertCell(1);
cellNode.appendChild(imgNode);
if(i==0){var textNode1=document.createTextNode(decodeURI(infoToInsert.TURN)+". ")
}else{if((i+1)==descPoints.length){var textNode1=document.createTextNode(decodeURI(infoToInsert.TURN)+". ")
}else{var textNode1=document.createTextNode(infoToInsert.TURN+". ")
}}var textNode2=document.createTextNode(infoToInsert.TURN2+". ");
var breakNode=document.createElement("br");
var linkNode=document.createElement("a");
linkNode.setAttribute("href","javascript:map.setCenter("+descPoints[i].getX()+","+descPoints[i].getY()+",map.getMaxScaleLevel());");
linkNode.setAttribute("class","routeLinkText");
linkNode.setAttribute("className","routeLinkText");
linkNode.appendChild(textNode1);
var cellNode=newRow.insertCell(2);
cellNode.appendChild(linkNode);
if(infoToInsert.TURN2!=null){cellNode.appendChild(breakNode);
cellNode.appendChild(textNode2)
}if((i+1)==descPoints.length){var textNode=document.createTextNode(infoToInsert.TIMETOTAL+" min");
var cellNode=newRow.insertCell(3);
cellNode.setAttribute("class","kmTimeTextAll");
cellNode.setAttribute("className","kmTimeTextAll");
cellNode.setAttribute("width","100");
cellNode.appendChild(textNode)
}else{if(infoToInsert.SECONDS<60){var segText=infoToInsert.SECONDS+" "+lngSource.SECONDS+"."
}else{var segText=infoToInsert.MINUTES+" "+lngSource.MINUTES+"."
}var textNode=document.createTextNode(segText);
var cellNode=newRow.insertCell(3);
cellNode.setAttribute("class","kmTimeText");
cellNode.setAttribute("className","kmTimeText");
cellNode.setAttribute("width","100");
cellNode.appendChild(textNode)
}if((i+1)==descPoints.length){var textNode=document.createTextNode(infoToInsert.DISTANCETOTAL+" km");
var cellNode=newRow.insertCell(4);
cellNode.setAttribute("class","kmTimeTextAll");
cellNode.setAttribute("className","kmTimeTextAll");
cellNode.setAttribute("width","100");
cellNode.appendChild(textNode)
}else{var textNode=document.createTextNode(infoToInsert.DISTANCE+" km");
var cellNode=newRow.insertCell(4);
cellNode.setAttribute("class","kmTimeText");
cellNode.setAttribute("className","kmTimeText");
cellNode.setAttribute("width","100");
cellNode.appendChild(textNode)
}}}this.onShown()
};
WGGBingRoute.prototype.projectRoutePoints=function(){if(this.pointsOnLine!=null&&this.pointsOnLine.length>0){for(var i=0;
i<this.pointsOnLine.length;
i++){var olPt=this.pointsOnLine[i].toOpenLayersLonLat();
var prjPt=olPt.transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913"));
this.pointsOnLine[i].setX(prjPt.lon);
this.pointsOnLine[i].setY(prjPt.lat)
}}if(this.bingRouteRequest.locations!=null&&this.bingRouteRequest.locations.length>0){for(var i=0;
i<this.bingRouteRequest.locations.length;
i++){var olPt=this.bingRouteRequest.locations[i].toOpenLayersLonLat();
var prjPt=olPt.transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913"));
this.bingRouteRequest.locations[i].setX(prjPt.lon);
this.bingRouteRequest.locations[i].setY(prjPt.lat)
}}};
WGGBingRoute.prototype.onError=function(){if(this.onErrorFunction!=null){this.onErrorFunction.call(this)
}else{alert("route could not be calculated")
}};
WGGBingRoute.prototype.getDescriptionLanguageMap=function(lng){if(lng=="DE"){return{NUMBER:"Nr.",DESC:"Ihre Wegbeschreibung",LENGTH:"Distanz",DURATION:"Dauer",LENGTH_TOTAL:"Gesamte Distanz:",DURATION_TOTAL:"Gesamte Dauer",SECONDS:"sek",MINUTES:"min"}
}else{if(lng=="IT"){return{NUMBER:"No.",DESC:"Il suo itinerario",LENGTH:"Distanza",DURATION:"Durata",LENGTH_TOTAL:"Distanza totale",DURATION_TOTAL:"Durata totale",SECONDS:"sec",MINUTES:"min"}
}else{if(lng=="HU"){return{NUMBER:"Szám",DESC:"Az Ön útvonala",LENGTH:"Távolság",DURATION:"Idö",LENGTH_TOTAL:"Távolság",DURATION_TOTAL:"Idö",SECONDS:"sec",MINUTES:"min"}
}else{if(lng=="PL"){return{NUMBER:"Nr.",DESC:"Opis drogi",LENGTH:"Dlugosc",DURATION:"Czas trwania",LENGTH_TOTAL:"Dlugosc",DURATION_TOTAL:"Czas trwania",SECONDS:"sec",MINUTES:"min"}
}else{return{NUMBER:"No.",DESC:"Your route description",LENGTH:"Distance",DURATION:"Time",LENGTH_TOTAL:"Total Distance",DURATION_TOTAL:"Total Time",SECONDS:"sec",MINUTES:"min"}
}}}}};
function WGGBingRouteRequest(url,ajaxLoader){var self=JSINER.extend(this,"WGGServerRequest");
self.url=url;
self.ajaxLoader=null;
self.setAjaxLoader(ajaxLoader);
if(self.ajaxLoader!=null){self.ajaxLoader.initialize()
}self.observers=[];
self.paramsHashMap=new WGGHashMap();
self.extent=null;
self.wkt=null;
self.locations=null;
self.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){self.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){self.debugInterface=new WGGNullDebugInterface()
}return self
}WGGBingRouteRequest.prototype.getWKT=function(){return this.wkt
};
WGGBingRouteRequest.prototype.getLocations=function(){return this.locations
};
WGGBingRouteRequest.prototype.update=function(){this.debugInterface.debug("WGGBingRouteRequest.update");
if(arguments.length==0){return
}var xmlDoc=arguments[0];
if(xmlDoc==null){return
}try{var routingNode=xmlDoc.getElementsByTagName("ROUTING")[0];
var summaryNode=routingNode.getElementsByTagName("SUMMARY")[0];
var segmentsNode=summaryNode.getElementsByTagName("SEGMENTS")[0];
if(segmentsNode){var segments=segmentsNode.firstChild.nodeValue;
if(segments==0){this.debugInterface.info("route could not be calculated");
this.notify({WKT:""});
return
}var extentNode=summaryNode.getElementsByTagName("EXTENT")[0];
var leftNode=extentNode.getElementsByTagName("LEFT")[0];
var rightNode=extentNode.getElementsByTagName("RIGHT")[0];
var topNode=extentNode.getElementsByTagName("TOP")[0];
var bottomNode=extentNode.getElementsByTagName("BOTTOM")[0];
this.extent=[leftNode,bottomNode,rightNode,topNode];
var resultNodes=routingNode.getElementsByTagName("RESULTS")[0].getElementsByTagName("RESULT");
var resultNodeCount=resultNodes.length;
this.debugInterface.debug("RESULT nodes count: "+resultNodeCount);
this.locations=[];
for(var i=0;
i<resultNodes.length;
i++){var resultNode=resultNodes[i];
var turnNode=resultNode.getElementsByTagName("TURN")[0];
var turn=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("TURN")[0]);
var attrX=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("XCO")[0]);
var attrY=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("YCO")[0]);
var turn2=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("TURN2")[0]);
var tcd=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("TCD")[0]);
var roadtype=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("ROADTYPE")[0]);
var distunit=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("DISTANCEUNIT")[0]);
var direction=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("DIRECTION")[0]);
var km=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("DISTANCE")[0]);
var kmTotal=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("DISTANCETOTAL")[0]);
var seconds=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("SECONDS")[0]);
var secondsTotal=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("SECONDSTOTAL")[0]);
var minutes=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("MINUTES")[0]);
var time=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("TIME")[0]);
var timeTotal=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("TIMETOTAL")[0]);
var desc={SET:(i+1),TURN:turn,X:((attrX)?attrX.replace(",","."):null),Y:((attrY)?attrY.replace(",","."):null),TURN2:turn2,TCD:tcd,ROADTYPE:roadtype,DISTANCEUNIT:distunit,DIRECTION:direction,DISTANCE:km.replace(".",","),DISTANCETOTAL:kmTotal.replace(".",","),SECONDS:seconds,SECONDSTOTAL:secondsTotal,MINUTES:minutes.replace(".",","),TIME:time,TIMETOTAL:timeTotal};
this.locations[i]=new WGGLocation(attrX,attrY,i,desc)
}this.wkt=WGGXmlUtils.getChildValue(routingNode.getElementsByTagName("WKT")[0]);
this.debugInterface.debug("WKT: "+this.wkt);
this.notify({WKT:this.wkt})
}}catch(e){this.debugInterface.error("error while processing xmlDoc, xmlDoc is probably not a XMLDocument-instance, see description:");
this.debugInterface.error(e)
}};
function WGGBingToken(url,ajaxLoader){var self=JSINER.extend(this,"WGGServerRequest");
self.url=url;
self.ajaxLoader=null;
self.setAjaxLoader(ajaxLoader);
if(self.ajaxLoader!=null){self.ajaxLoader.initialize()
}self.observers=[];
self.paramsHashMap=new WGGHashMap();
self.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){self.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){self.debugInterface=new WGGNullDebugInterface()
}self.token="";
return self
}WGGBingToken.prototype.send=function(){if(this.token!=""){this.debugInterface.debug("token is already in cache");
this.notify({TOKEN:this.token});
this.onUpdate();
return
}WGGBingToken.superClass.send.call(this)
};
WGGBingToken.prototype.update=function(){this.debugInterface.debug("WGGBingToken.update");
if(arguments.length==0){return
}var xmlDoc=arguments[0];
if(xmlDoc==null){return
}this.debugInterface.debug(xmlDoc);
try{var gettokenNode=xmlDoc.getElementsByTagName("GETBINGTOKEN")[0];
if(!gettokenNode){this.debugInterface.warn("getbingtokenNode must not be null or undefined");
return
}var statusNode=gettokenNode.getElementsByTagName("STATUS")[0];
if(statusNode){var status=statusNode.firstChild.nodeValue;
if(status!="OK"){throw"token doesnt return OK on requesting a token"
}var tokenNode=gettokenNode.getElementsByTagName("TOKEN")[0];
this.token=tokenNode.firstChild.nodeValue;
this.debugInterface.debug("token: "+this.token);
if(isOpera){this.ajaxLoader.initialize()
}this.notify({TOKEN:this.token})
}this.onUpdate()
}catch(e){this.debugInterface.error("error while processing xmlDoc, xmlDoc is probably not a XMLDocument-instance, see description:");
this.debugInterface.error(e)
}};
function WGGBingVerifier(url,ajaxLoader){var self=JSINER.extend(this,"WGGServerRequest");
self.url=url;
self.ajaxLoader=null;
self.setAjaxLoader(ajaxLoader);
if(self.ajaxLoader!=null){self.ajaxLoader.initialize()
}self.observers=[];
self.paramsHashMap=new WGGHashMap();
self.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){self.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){self.debugInterface=new WGGNullDebugInterface()
}self.windowsLiveID="";
self.windowsLivePWD="";
return self
}WGGBingVerifier.prototype.send=function(){if(this.windowsLiveID!=""&&this.windowsLivePWD!=""){this.debugInterface.debug("the user details are already in cache");
this.notify({ID:this.windowsLiveID,PWD:this.windowsLivePWD});
this.onUpdate();
return
}WGGBingVerifier.superClass.send.call(this)
};
WGGBingVerifier.prototype.update=function(){this.debugInterface.debug("WGGBingVerifier.update");
if(arguments.length==0){return
}var xmlDoc=arguments[0];
if(xmlDoc==null){return
}this.debugInterface.debug(xmlDoc);
try{var getregNode=xmlDoc.getElementsByTagName("GETBINGREGISTRATION")[0];
if(!getregNode){this.debugInterface.warn("getbingregistrationNode must not be null or undefined");
return
}var statusNode=getregNode.getElementsByTagName("STATUS")[0];
if(statusNode){var status=statusNode.firstChild.nodeValue;
if(status!="OK"){throw"verifier doesnt return OK on requesting a registration"
}var idNode=getregNode.getElementsByTagName("ID")[0];
var pwdNode=getregNode.getElementsByTagName("PWD")[0];
this.windowsLiveID=idNode.firstChild.nodeValue;
this.windowsLivePWD=pwdNode.firstChild.nodeValue;
this.debugInterface.debug("ID:"+this.windowsLiveID+" PWD:"+this.windowsLivePWD);
if(isOpera){this.ajaxLoader.initialize()
}this.notify({ID:this.windowsLiveID,PWD:this.windowsLivePWD})
}this.onUpdate()
}catch(e){this.debugInterface.error("error while processing xmlDoc, xmlDoc is probably not a XMLDocument-instance, see description:");
this.debugInterface.error(e)
}};
function WGGAbstractGeometry(){}WGGAbstractGeometry.prototype.contains=function(x,y,w,h){return false
};
WGGAbstractGeometry.prototype.getBounds=function(){return null
};
WGGAbstractGeometry.prototype.intersects=function(x,y,w,h){return false
};
WGGAbstractGeometry.prototype.toString=function(){return""
};
function WGGCircle(center,perimeter){var self=JSINER.extend(this,WGGAbstractGeometry);
self.center=center;
self.perimeter=perimeter;
return self
}WGGCircle.prototype.contains=function(){return false
};
WGGCircle.prototype.getBounds=function(){return new WGGExtent(this.center.x-this.perimeter,this.center.y-this.perimeter,this.center.x+this.perimeter,this.center.y+this.perimeter)
};
WGGCircle.prototype.intersects=function(){return false
};
WGGCircle.prototype.toString=function(){return""
};
function WGGExtent(minx,miny,maxx,maxy){var self=JSINER.extend(this,WGGAbstractGeometry);
if(!WGGDataTypeUtils.isNumber(minx)){return self
}if(!WGGDataTypeUtils.isNumber(miny)){return self
}if(!WGGDataTypeUtils.isNumber(maxx)){return self
}if(!WGGDataTypeUtils.isNumber(maxy)){return self
}if(minx>maxx){throw"minx must not be greater than maxx"
}if(miny>maxy){throw"miny must not be greater than maxy"
}self.minx=minx;
self.miny=miny;
self.maxx=maxx;
self.maxy=maxy;
return self
}WGGExtent.prototype.getCenter=function(){return new WGGPoint((this.minx+this.maxx)/2,(this.miny+this.maxy)/2)
};
WGGExtent.prototype.getMinx=function(){return this.minx
};
WGGExtent.prototype.getMaxx=function(){return this.maxx
};
WGGExtent.prototype.getMiny=function(){return this.miny
};
WGGExtent.prototype.getMaxy=function(){return this.maxy
};
WGGExtent.prototype.getWidth=function(){return this.maxx-this.minx
};
WGGExtent.prototype.getHeight=function(){return this.maxy-this.miny
};
WGGExtent.prototype.addPoint=function(point){if(point==null){return
}var x=point.getX();
var y=point.getY();
if(x<this.minx){this.minx=x
}if(x>this.maxx){this.maxx=x
}if(y<this.miny){this.miny=y
}if(y>this.maxy){this.maxy=y
}};
WGGExtent.prototype.extendByFactor=function(factor){if(factor>=1){return
}var w=this.maxx-this.minx;
var h=this.maxy-this.miny;
var wDelta=w*factor;
var hDelta=h*factor;
this.minx=parseFloat(this.minx)-wDelta;
this.miny=parseFloat(this.miny)-hDelta;
this.maxx=parseFloat(this.maxx)+wDelta;
this.maxy=parseFloat(this.maxy)+hDelta
};
WGGExtent.prototype.setFromWKT=function(wkt){if(wkt==null){return
}wkt=wkt.replace(/^POLYGON([ ]*)\(\(/g,"").replace(/\)\)$/g,"");
var pairs=wkt.split(",");
if(pairs.length!=5){throw new Error("wkt should be a polygon with 5 coordinate pairs (was "+pairs.length+")")
}var minx_miny=WGGStringUtils.trim(pairs[0]);
var maxx_maxy=WGGStringUtils.trim(pairs[2]);
var bottomLeft=minx_miny.split(" ");
if(bottomLeft.length!=2){throw new Error("bottomLeft should be a coordinate pair with 2 pieces (was "+bottomLeft.length+")")
}var topRight=maxx_maxy.split(" ");
if(topRight.length!=2){throw new Error("toRight should be a coordinate pair with 2 pieces (was "+topRight.length+")")
}this.minx=parseFloat(bottomLeft[0]);
this.miny=parseFloat(bottomLeft[1]);
this.maxx=parseFloat(topRight[0]);
this.maxy=parseFloat(topRight[1])
};
WGGExtent.prototype.toGLatLngBounds=function(){if(WGGDataTypeUtils.isFunction(GLatLngBounds)){return new GLatLngBounds(new GLatLng(this.miny,this.minx),new GLatLng(this.maxy,this.maxx))
}return null
};
WGGExtent.prototype.toOpenLayersBounds=function(){if(WGGDataTypeUtils.isFunction(OpenLayers.Bounds)){return new OpenLayers.Bounds(this.minx,this.miny,this.maxx,this.maxy)
}return null
};
WGGExtent.prototype.toBingBounds=function(){if(WGGDataTypeUtils.isFunction(VELatLongRectangle)){return new VELatLongRectangle(new VELatLong(this.maxy,this.minx),new VELatLong(this.miny,this.maxx))
}return null
};
WGGExtent.prototype.toWKT=function(){return"POLYGON(("+this.minx+" "+this.miny+","+this.maxx+" "+this.miny+","+this.maxx+" "+this.maxy+","+this.minx+" "+this.maxy+","+this.minx+" "+this.miny+"))"
};
WGGExtent.prototype.toString=function(){return this.minx+","+this.miny+","+this.maxx+","+this.maxy
};
function WGGLocation(x,y,id,desc){var self=JSINER.extend(this,"WGGPoint");
self.x=x;
self.y=y;
self.id=id;
self.desc=desc;
return self
}WGGLocation.prototype.setId=function(id){this.id=id
};
WGGLocation.prototype.getId=function(){return this.id
};
WGGLocation.prototype.setDesc=function(desc){this.desc=desc
};
WGGLocation.prototype.getDesc=function(){return this.desc
};
WGGLocation.prototype.toString=function(){var str="id="+this.id;
if(WGGDataTypeUtils.isObject(this.desc)){for(var a in this.desc){str+=";"+a+"="+this.desc[a]
}}return str
};
WGGLocation.prototype.equals=function(location){if(location==null){return false
}if(typeof location.id=="undefined"){return false
}return(this.id==location.id)
};
function WGGPoint(x,y){this.x=x;
this.y=y;
this.wkt=null;
this.prj=null
}WGGPoint.prototype.setX=function(x){this.x=x
};
WGGPoint.prototype.getX=function(){return this.x
};
WGGPoint.prototype.setY=function(y){this.y=y
};
WGGPoint.prototype.getY=function(){return this.y
};
WGGPoint.prototype.translate=function(x,y){this.x+=x;
this.y+=y
};
WGGPoint.prototype.equals=function(point){if(this.x==point.x&&this.y==point.y){return true
}return false
};
WGGPoint.prototype.toString=function(){return"["+this.x+", "+this.y+"]"
};
WGGPoint.prototype.toGLatLng=function(){if(WGGDataTypeUtils.isFunction(GLatLng)){return new GLatLng(this.y,this.x)
}return null
};
WGGPoint.prototype.toVELatLong=function(){if(WGGDataTypeUtils.isFunction(VELatLong)){return new VELatLong(this.y,this.x)
}return null
};
WGGPoint.prototype.toOpenLayersLonLat=function(){if(WGGDataTypeUtils.isFunction(OpenLayers.LonLat)){return new OpenLayers.LonLat(this.x,this.y)
}return null
};
WGGPoint.prototype.isInExtent=function(extent){var result=false;
if(this.x<extent.getMaxx()&&this.x>extent.getMinx()&&this.y<extent.getMaxy()&&this.y>extent.getMiny()){result=true
}return result
};
WGGPoint.prototype.pythagoreanDistanceTo=function(point){var distance=(this.x-point.getX())*(this.x-point.getX())+(this.y-point.getY())*(this.y-point.getY());
distance=Math.sqrt(distance);
return distance
};
WGGPoint.prototype.sphericalDistanceTo=function(point){var longA=this.x;
var longB=point.getX();
var latA=this.y;
var latB=point.getY();
if(Math.abs(longA-longB)>=180){if(longA<=-180){longA=-179.99999
}if(longA>=180){longA=179.99999
}if(longB<=-180){longB=-179.99999
}if(longB>=180){longB=179.99999
}var erg=this.sphericalDistanceCalculation(longA,latA,0,latB-latA)+this.sphericalDistanceCalculation(0,latB-latA,longB,latB);
if(erg>20000){erg=40000-erg
}if(erg<0){erg=0
}return erg
}else{return this.sphericalDistanceCalculation(longA,latA,longB,latB)
}};
WGGPoint.prototype.sphericalDistanceCalculation=function(longA,latA,longB,latB){var degreeToMeter=111120;
var pi=4*Math.atan(1);
var degToRad=180/pi;
dLong=Math.abs(longB-longA);
var cosDlong=Math.cos(dLong/degToRad);
var cosLatA=Math.cos(latA/degToRad);
var cosLatB=Math.cos(latB/degToRad);
var sinLatA=Math.sin(latA/degToRad);
var sinLatB=Math.sin(latB/degToRad);
x=(cosLatA*cosLatB*cosDlong)+(sinLatA*sinLatB);
if(x==1||x==-1){return 0
}else{var val0=Math.atan(-x/Math.sqrt(-x*x+1));
var val1=2*Math.atan(1)*degToRad*degreeToMeter;
var val=val0+val1;
val=(Math.atan(-x/Math.sqrt(-x*x+1))+2*Math.atan(1))*degToRad*degreeToMeter;
val=Math.round(val,0);
val=val/10;
val=Math.round(val);
val=val/100;
return val
}};
function WGGPolygon(points){var self=JSINER.extend(this,WGGAbstractGeometry);
self.points=points;
return self
}WGGPolygon.prototype.contains=function(){return false
};
WGGPolygon.prototype.getBounds=function(){var minx=this.points[0].getX();
var miny=this.points[0].getY();
var maxx=this.points[0].getX();
var maxy=this.points[0].getY();
for(var i=1;
i<this.points.length;
i++){var actX=this.points[i].getX();
var actY=this.points[i].getY();
if(actX<minx){minx=actX
}if(actX>maxx){maxx=actX
}if(actY<miny){miny=actY
}if(actY<maxy){maxy=actY
}}var ext=new WGGExtent(minx,miny,maxx,maxy);
return ext
};
WGGPolygon.prototype.intersects=function(){return false
};
WGGPolygon.prototype.toString=function(){return""
};
function WGGPolyline(points){var self=JSINER.extend(this,WGGAbstractGeometry);
self.points=points;
return self
}WGGPolyline.prototype.getBounds=function(){var minx=this.points[0].getX();
var miny=this.points[0].getY();
var maxx=this.points[0].getX();
var maxy=this.points[0].getY();
for(var i=1;
i<this.points.length;
i++){var actX=this.points[i].getX();
var actY=this.points[i].getY();
if(actX<minx){minx=actX
}if(actX>maxx){maxx=actX
}if(actY<miny){miny=actY
}if(actY<maxy){maxy=actY
}}var ext=new WGGExtent(minx,miny,maxx,maxy);
return ext
};
WGGPolyline.prototype.getPoints=function(){return this.points
};
WGGPolyline.prototype.toString=function(){var txt="";
for(var i=0;
i<this.points.length;
i++){if(i==0){txt=txt+this.points[i].toString
}else{txt=txt+"-"+this.points[i].toString
}}return txt
};
function WGGGoogleGeocoder(){var self=JSINER.extend(this,"WGGSubject");
self.observers=[];
self.nativeGeocoder=new GClientGeocoder();
self.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){self.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){self.debugInterface=new WGGNullDebugInterface()
}return self
}WGGGoogleGeocoder.prototype.geocode=function(map){if(map==null){return
}this.debugInterface.debug(map);
var add="";
if(map.ADRLINE){add=map.ADRLINE
}else{if(map.STRHNR){add+=map.STRHNR
}else{if(map.STR){add+=map.STR
}if(map.HNR){add+=" "+map.HNR
}}if(add!=""){add+=", "
}if(map.ZIP){add+=map.ZIP
}if(map.CITY){add+=" "+map.CITY
}if(add==""&&map.ZIPCITY){add+=" "+map.ZIPCITY
}if(map.REGION){if(add==""){add+=map.REGION
}else{add+=", "+map.REGION
}}if(add==""){return
}else{add+=","
}if(map.CTRISO){var baseCountryCode="";
var compareCTRISO=map.CTRISO.replace("*","");
for(key in WGGGoogleGeocoder.countryNameCodesMap){if(WGGGoogleGeocoder.countryNameCodesMap[key]==compareCTRISO){baseCountryCode=key
}}if(baseCountryCode!=""){this.nativeGeocoder.setBaseCountryCode(baseCountryCode)
}}add+=" "+baseCountryCode
}var self=this;
function callback(){self.update.apply(self,arguments)
}this.nativeGeocoder.setCache(null);
this.nativeGeocoder.getLocations(add,callback)
};
WGGGoogleGeocoder.prototype.update=function(){this.debugInterface.debug("WGGGoogleGeocoder.update");
var args=[];
for(var i=0;
i<arguments.length;
i++){args[i]=arguments[i]
}this.debugInterface.debug(args);
var result=arguments[0];
var retVal={};
retVal.INPUT=result.name;
retVal.SUMMARY={STATUS:result.Status["code"]};
var acc=null;
var ctriso=null;
var placemark=result.Placemark;
var locations=[];
var resultCounter=0;
if(WGGDataTypeUtils.isArray(placemark)){for(var i=0;
i<placemark.length;
i++){var entry=placemark[i];
var id=entry.id;
var address=entry.address;
var addressDetails=entry.AddressDetails;
acc=addressDetails.Accuracy;
if(addressDetails.Country){ctriso=addressDetails.Country["CountryNameCode"]
}var point=entry.Point;
var coordinates=point.coordinates;
var lat=coordinates[0];
var lng=coordinates[1];
locations[i]=new WGGLocation(lat,lng,id,address);
resultCounter=resultCounter+1
}}retVal.OUTPUT=locations;
retVal.SUMMARY["ACC"]=WGGGoogleGeocoder.accuracyMap[acc];
retVal.SUMMARY["CTRISO"]=WGGGoogleGeocoder.countryNameCodesMap[ctriso];
retVal.SUMMARY["RECORDS"]=resultCounter;
this.notify(retVal)
};
WGGGoogleGeocoder.countryNameCodesMap={AR:"ARG",AT:"AUT",BE:"BEL",BA:"BIH",BG:"BGR",CA:"CAN",CH:"CHE",DE:"DEU",DK:"DNK",ES:"ESP",FR:"FRA",GB:"GBR",GR:"GRC",HR:"HRV",HU:"HUN",IE:"IRL",IT:"ITA",LU:"LUX",MX:"MEX",NO:"NOR",PT:"PRT",RO:"ROU",RU:"RUS",SK:"SVK",SI:"SVN",SE:"SWE"};
WGGGoogleGeocoder.accuracyMap={0:"CTR",1:"CTR",2:"ADM",3:"CITY",4:"CITY",5:"ZIP",6:"STR",7:"STR",8:"ADD",9:"ADD"};
function WGGChangeEvent(source){this.source=source
}WGGChangeEvent.prototype.getSource=function(){return this.source
};
function WGGChangeListener(){}WGGChangeListener.prototype.stateChanged=function(changeEvent){};
function WGGAbstractGUIStuffFactory(){}WGGAbstractGUIStuffFactory.createFactory=function(type){if(type=="bb"){return new WGGBackbaseGUIStuffFactory()
}else{if(type=="simple0"){return new WGGSimpleGUIStuffFactory()
}}return null
};
WGGAbstractGUIStuffFactory.prototype.createTreeNode=function(parentTree,parentNode,handledObj){return null
};
WGGAbstractGUIStuffFactory.prototype.createEventsManager=function(){return null
};
WGGAbstractGUIStuffFactory.prototype.createTreeModel=function(){return null
};
WGGAbstractGUIStuffFactory.prototype.createTree=function(){return null
};
function WGGAjaxAddressSearchComboBox(input,button,list,wrapper,checkbox,addressProcessingIndicator,addressXCO,addressYCO){this.input=input;
this.button=button;
this.list=list;
this.wrapper=wrapper;
this.checkbox=checkbox;
this.addressProcessingIndicator=addressProcessingIndicator;
this.addressXCO=addressXCO;
this.addressYCO=addressYCO;
this.arr=new Array();
this.activeItemInList=-1;
this.geocoder=null;
this.inputEntry="";
this.outputEntries=new Array();
this.otherAjaxAddressSearchComboBoxObjects=new Array();
this.input.comboBoxRef=this;
this.button.comboBoxRef=this;
this.keyUpTimestamp=null;
this.keyUpGap=400;
this.inputObserverHandle=null;
this.status=0;
this.acc="AUTO";
this.aObjTemplate=new Object();
this.aObjTemplate.backRef=this;
this.aObjTemplate.handleClick=function(){var thisItem=(isIE)?this.innerText:this.firstChild.nodeValue;
this.backRef.setWrapperVisible(false);
if((this.backRef.addressXCO.value=="")||(this.backRef.addressXCO.value!=this.xco||this.backRef.addressYCO.value!=this.yco)){WGGAjaxAddressSearchComboBox.addressParamsHashMap.put(this.backRef.inputEntry,thisItem);
if(this.backRef.addressXCO){this.backRef.addressXCO.value=this.xco
}if(this.backRef.addressYCO){this.backRef.addressYCO.value=this.yco
}this.backRef.input.value=thisItem;
this.backRef.deactivate();
this.className="activeItem";
this.backRef.resetAll()
}};
if(this.input!=null){inherits(new Observer(),this.input);
this.input.update=function(){this.comboBoxRef.wrapper.style.visibility="visible"
};
this.input.setValue=function(value){this.value=value
};
if(this.wrapper!=null){var pos=getPosition(this.input);
this.wrapper.style.left=pos.left+"px";
this.wrapper.style.top=(pos.top+20)+"px";
this.wrapper.style.zIndex=1000
}this.input.onfocus=function(e){window.document.comboBoxRef=this.comboBoxRef
};
this.input.onkeyup=function(e){if(!this.comboBoxRef.checkbox){return true
}if(this.comboBoxRef.checkbox.checked==false){return true
}var self=this;
var asciiValue=getKeyboardKey(e);
if(asciiValue<41&&asciiValue!=8){return
}this.comboBoxRef.keyUpTimestamp=new Date().getTime();
if(self.comboBoxRef.inputObserverHandle==null){self.comboBoxRef.inputObserverHandle=window.setInterval(function(){if(self.value.length==0){self.comboBoxRef.reset();
self.comboBoxRef.wrapper.style.visibility="hidden";
self.comboBoxRef.status=0;
self.comboBoxRef.addressXCO.value="";
self.comboBoxRef.addressYCO.value="";
self.comboBoxRef.resetAll();
window.clearInterval(self.comboBoxRef.inputObserverHandle);
self.comboBoxRef.inputObserverHandle=null;
self.comboBoxRef.addressProcessingIndicator.style.visibility="hidden";
return
}else{if(self.comboBoxRef.status==1){var countOfItemsInList=self.comboBoxRef.fillList(self.value);
self.comboBoxRef.wrapper.style.visibility="visible";
if(countOfItemsInList==0){self.comboBoxRef.reset();
self.comboBoxRef.resetAll();
WGGAjaxAddressSearchComboBox.addressParamsHashMap.put(self.comboBoxRef.inputEntry,self.value+"*");
WGGAjaxAddressSearchComboBox.addressParamsHashMap.put("ACC",self.comboBoxRef.acc);
self.comboBoxRef.geocoder.geocode(WGGAjaxAddressSearchComboBox.addressParamsHashMap);
self.comboBoxRef.addressProcessingIndicator.style.visibility="visible";
self.comboBoxRef.status=2
}self.comboBoxRef.addressProcessingIndicator.style.visibility="hidden";
window.clearInterval(self.comboBoxRef.inputObserverHandle);
self.comboBoxRef.inputObserverHandle=null;
self.comboBoxRef.status=0;
return
}if(self.comboBoxRef.status==2){return
}}var now=new Date().getTime();
var timeDiff=now-self.comboBoxRef.keyUpTimestamp;
if(timeDiff<self.comboBoxRef.keyUpGap*0.95){return
}self.comboBoxRef.reset();
self.comboBoxRef.resetAll();
WGGAjaxAddressSearchComboBox.addressParamsHashMap.put(self.comboBoxRef.inputEntry,self.value+"*");
WGGAjaxAddressSearchComboBox.addressParamsHashMap.put("ACC",self.comboBoxRef.acc);
self.comboBoxRef.status=2;
self.comboBoxRef.geocoder.geocode(WGGAjaxAddressSearchComboBox.addressParamsHashMap);
self.comboBoxRef.addressProcessingIndicator.style.visibility="visible"
},self.comboBoxRef.keyUpGap)
}}
}window.document.onkeydown=function(e){if(this.comboBoxRef==null){return
}var key=getKeyboardKey(e);
if(key!=38&&key!=40&&key!=35&&key!=36){return
}var tableObj=null;
for(var i=0;
i<this.comboBoxRef.list.childNodes.length;
i++){if(this.comboBoxRef.list.childNodes[i].tagName=="TABLE"){var currentListIndex=this.comboBoxRef.activeItemInList;
var oldListIndex=-1;
if(currentListIndex==-1&&(key==35||key==36)){return
}switch(key){case 40:if(this.comboBoxRef.wrapper.style.visibility=="hidden"){this.comboBoxRef.wrapper.style.visibility="visible";
break
}currentListIndex++;
oldListIndex=currentListIndex-1;
break;
case 38:currentListIndex--;
oldListIndex=currentListIndex+1;
break;
case 36:if(this.comboBoxRef.wrapper.style.visibility=="hidden"){break
}oldListIndex=currentListIndex;
currentListIndex=0;
break;
case 35:if(this.comboBoxRef.wrapper.style.visibility=="hidden"){break
}oldListIndex=currentListIndex;
currentListIndex=this.comboBoxRef.arr.length-1;
break
}var tbodyObj=this.comboBoxRef.list.childNodes[i].firstChild;
if(currentListIndex==-1){if(oldListIndex>=0&&oldListIndex<tbodyObj.childNodes.length){var aObjToBeDeactivated=tbodyObj.childNodes[oldListIndex].childNodes[0].firstChild;
aObjToBeDeactivated.className="inactiveItem";
try{this.comboBoxRef.input.focus()
}catch(e){}this.comboBoxRef.activeItemInList=currentListIndex
}}else{var currentListIndexActivated=false;
if(currentListIndex>=0&&currentListIndex<tbodyObj.childNodes.length){var aObj=tbodyObj.childNodes[currentListIndex].childNodes[0].firstChild;
aObj.className="activeItem";
try{aObj.focus()
}catch(e){}currentListIndexActivated=true;
this.comboBoxRef.activeItemInList=currentListIndex
}if(oldListIndex>=0&&oldListIndex<tbodyObj.childNodes.length){var aObjToBeDeactivated=tbodyObj.childNodes[oldListIndex].childNodes[0].firstChild;
if(currentListIndexActivated){aObjToBeDeactivated.className="inactiveItem"
}else{aObjToBeDeactivated.className="activeItem";
try{aObjToBeDeactivated.focus()
}catch(e){}}}}break
}}};
window.document.onclick=function(e){if(!e&&isIE){e=window.event
}if(this.comboBoxRef==null){return
}var pos=getPosition(this.comboBoxRef.wrapper);
pos.height+=20;
pos.top-=20;
if(!(e.clientX>pos.left&&e.clientX<(pos.left+pos.width)&&e.clientY>pos.top&&e.clientY<(pos.top+pos.height))){this.comboBoxRef.wrapper.style.visibility="hidden"
}};
this.button.onclick=function(e){if(window.document.comboBoxRef!=null){if(window.document.comboBoxRef!=this.comboBoxRef){window.document.comboBoxRef.setWrapperVisible(false)
}}this.comboBoxRef.setWrapperVisible(!this.comboBoxRef.isWrapperVisible());
window.document.comboBoxRef=this.comboBoxRef
};
this.setGeocoder=function(geocoder){this.geocoder=geocoder;
this.geocoder.addObserver(this);
this.geocoder.addObserver(this.input)
};
this.setInputEntry=function(inputEntry){this.inputEntry=inputEntry
};
this.setOutputEntries=function(outputEntries){this.outputEntries=outputEntries
};
this.setOtherAjaxAddressSearchComboBoxObjects=function(otherAjaxAddressSearchComboBoxObjects){this.otherAjaxAddressSearchComboBoxObjects=otherAjaxAddressSearchComboBoxObjects
};
this.getArr=function(){return this.arr
};
this.setAcc=function(acc){this.acc=acc
};
this.getAcc=function(){return this.acc
};
this.getArrAsCookieValue=function(){var arrCookie="";
for(var i=0;
i<this.arr.length;
i++){if(arrCookie!=""){arrCookie+="\n"
}arrCookie+=this.arr[i].getAddressAsCookieValue()
}return arrCookie
};
this.setArrFromCookieValue=function(value){if(this.input.value==""){return
}if(value==null){this.input.value="";
return
}var arrCookie=value.split("\n");
var indexOfItemToBeSetActive=-1;
for(var i=0;
i<arrCookie.length;
i++){var theElement=arrCookie[i];
var addressObj=new Address(0,0);
addressObj.setAddressFromCookieValue(theElement);
this.arr.push(addressObj);
this.addItem2List(addressObj);
if(indexOfItemToBeSetActive==-1){var addressObjAsString=addressObj.getAddressHashMap().toString(this.outputEntries,true," ");
if(addressObjAsString.toLowerCase().indexOf(this.input.value.toLowerCase())==0){indexOfItemToBeSetActive=i
}}}if(indexOfItemToBeSetActive!=-1){this.changeList("activate",indexOfItemToBeSetActive,indexOfItemToBeSetActive+1)
}this.status=1;
WGGAjaxAddressSearchComboBox.addressParamsHashMap.put(this.inputEntry,this.input.value+"*")
};
this.reset=function(){this.arr=new Array();
this.changeList("delete",0);
this.activeItemInList=-1
};
this.resetAll=function(){if(this.otherAjaxAddressSearchComboBoxObjects.length!=0){for(var k=0;
k<this.otherAjaxAddressSearchComboBoxObjects.length;
k++){this.otherAjaxAddressSearchComboBoxObjects[k].reset();
this.otherAjaxAddressSearchComboBoxObjects[k].input.value="";
if(this.otherAjaxAddressSearchComboBoxObjects[k].addressXCO){this.otherAjaxAddressSearchComboBoxObjects[k].addressXCO.value=""
}if(this.otherAjaxAddressSearchComboBoxObjects[k].addressYCO){this.otherAjaxAddressSearchComboBoxObjects[k].addressYCO.value=""
}AjaxAddressSearchComboBox.addressParamsHashMap.remove(this.otherAjaxAddressSearchComboBoxObjects[k].inputEntry)
}}};
this.deactivate=function(){this.changeList("deactivate",0)
};
this.createTable=function(){var tableObj=null;
for(var i=0;
i<this.list.childNodes.length;
i++){if(this.list.childNodes[i].tagName=="TABLE"){tableObj=this.list.childNodes[i];
break
}}if(tableObj==null){tableObj=thisDoc.createElement("table");
this.list.appendChild(tableObj);
var tbody=thisDoc.createElement("tbody");
tableObj.appendChild(tbody)
}return tableObj
};
this.update=function(){if(arguments.length<2){return
}var acc=arguments[0];
if(this.acc!="AUTO"){if(this.acc!=acc){this.status=1;
return
}}var addressObj=arguments[1];
if(addressObj){var addressHashMap=addressObj.getAddressHashMap();
this.arr.push(addressObj);
this.addItem2List(addressObj);
this.status=1
}else{this.status=1
}};
this.addItem2List=function(addressObj){var tableObj=this.createTable();
var tbody=tableObj.firstChild;
var rowObj=thisDoc.createElement("tr");
tbody.appendChild(rowObj);
var cellObj=thisDoc.createElement("td");
rowObj.appendChild(cellObj);
var aObj=thisDoc.createElement("a");
inherits(this.aObjTemplate,aObj);
aObj.onclick=aObj.handleClick;
cellObj.appendChild(aObj);
aObj.href="#";
var addressHashMap=addressObj.getAddressHashMap();
var item=addressHashMap.toString(this.outputEntries,true," ");
var title=addressHashMap.toString(this.outputEntries,false," ");
aObj.xco=addressObj.x;
aObj.yco=addressObj.y;
if(isIE){aObj.innerText=item
}else{var textNode=thisDoc.createTextNode(item);
aObj.appendChild(textNode)
}aObj.title=title;
return item
};
this.fillList=function(substr){var tableObj=this.createTable();
var countOfRows=0;
var tbody=tableObj.firstChild;
if(tbody){countOfRows=tbody.childNodes.length
}var countOfArr=this.arr.length;
var i=0;
var j=0;
while(i<countOfArr){var addressHashMap=this.arr[i].getAddressHashMap();
var text=addressHashMap.toString(this.outputEntries,true," ");
var title=addressHashMap.toString(this.outputEntries,false," ");
var textLowerCase=text.toLowerCase();
var rowObj=tbody.childNodes[j];
if(!rowObj){rowObj=thisDoc.createElement("tr");
tbody.appendChild(rowObj);
var cellObj=thisDoc.createElement("td");
rowObj.appendChild(cellObj);
var aObj=thisDoc.createElement("a");
inherits(this.aObjTemplate,aObj);
aObj.onclick=aObj.handleClick;
cellObj.appendChild(aObj);
aObj.href="#"
}var cellObj=rowObj.firstChild;
var aObj=cellObj.firstChild;
aObj.className="inactiveItem";
aObj.xco=this.arr[i].x;
aObj.yco=this.arr[i].y;
if(isIE){aObj.innerText=text
}else{var textNode=aObj.firstChild;
if(!textNode){textNode=thisDoc.createTextNode(text);
aObj.appendChild(textNode)
}else{textNode.nodeValue=text
}}aObj.title=title;
j++;
i++
}this.changeList("delete",j);
return j
};
this.changeList=function(action,start,end){if(action!="delete"&&action!="deactivate"&&action!="activate"){return
}var tableObj=this.createTable();
var tbody=tableObj.firstChild;
if(tbody){if(end<=start||end>tbody.childNodes.length){end=tbody.childNodes.length
}if(!end){end=tbody.childNodes.length
}for(var i=(end-1);
i>=start;
i--){switch(action){case"delete":tbody.removeChild(tbody.childNodes[tbody.childNodes.length-1]);
break;
case"deactivate":case"activate":var rowObj=tbody.childNodes[i];
if(rowObj){for(var j=0;
j<rowObj.childNodes.length;
j++){var cellObj=rowObj.firstChild;
if(cellObj){var aObj=cellObj.firstChild;
if(action=="deactivate"){aObj.className="inactiveItem"
}else{aObj.className="activeItem"
}}}}break;
default:}}}};
this.setWrapperVisible=function(show){var style=this.wrapper.style;
if(style){style.visibility=(show==true)?"visible":"hidden"
}};
this.isWrapperVisible=function(){var style=this.wrapper.style;
return(style.visibility=="visible")
}
}WGGAjaxAddressSearchComboBox.addressParamsHashMap=null;
function WGGBackbaseEventsManager(handler,bbObject){this.handler=handler;
this.bbObject=bbObject;
this.handlerMethodCache={};
this.handlerCaptureCache={};
this.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){this.debugInterface=WGGAbstractDebugInterface.gDebugInterface;
WGGBackbaseEventsManager.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){this.debugInterface=new WGGNullDebugInterface();
WGGBackbaseEventsManager.debugInterface=new WGGNullDebugInterface()
}}WGGBackbaseEventsManager.prototype.addEventListener=function(){if(arguments==null){throw"arguments must not be null"
}if(arguments.length!=3){throw"arguments.length should be 3; see backbase specification for further details about addEventListener method"
}var type=arguments[0];
if(!WGGDataTypeUtils.isString(type)){throw"type should be a String object"
}var handlerMethod=arguments[1];
if(!WGGDataTypeUtils.isFunction(handlerMethod)){throw"handlerMethod should be a Function object"
}var useCapture=arguments[2];
if(!WGGDataTypeUtils.isBoolean(useCapture)){throw"useCapture should be a Boolean object"
}var handlerObject={handler:this.handler,type:type,handlerMethod:handlerMethod,useCapture:useCapture};
var outerHandler=function(){var currentHandlerImpl=null;
var m=new WGGMethod(this.handlerMethod);
var handlerMethodName=m.getName();
m.finalize();
try{if(this.handler!=null&&handlerMethodName!=null&&handlerMethodName!=""){for(var key in this.handler){var member=this.handler[key];
if(typeof member!="function"){continue
}var method=new WGGMethod(member);
var methodName=method.getName();
method.finalize();
if(methodName==null||methodName==""){continue
}if(methodName!=handlerMethodName){continue
}currentHandlerImpl=member;
break
}}}catch(e){WGGAbstractDebugInterface.gDebugInterface.debug("Exception thrown while detecting a new implementation of the handler ("+this.type+")")
}finally{(currentHandlerImpl||handlerMethod).apply(this.handler,arguments)
}}.__wggClosure(handlerObject);
this.bbObject.addEventListener(type,outerHandler,useCapture);
this.handlerMethodCache[type]=outerHandler;
this.handlerCaptureCache[type]=useCapture;
return true
};
WGGBackbaseEventsManager.prototype.addEventListenersMap=function(evtListenersMap,useCapture){if(evtListenersMap==null){return false
}for(var evtName in evtListenersMap){var handlerMethod=evtListenersMap[evtName];
if(WGGDataTypeUtils.isString(handlerMethod)){if(this.handler==null){continue
}if(!this.handler[handlerMethod]){continue
}handlerMethod=this.handler[handlerMethod]
}else{if(WGGDataTypeUtils.isFunction(handlerMethod)){}else{throw"handler function associated with event "+evtName+" is neither String (name of the Function) nor Function object"
}}this.addEventListener(evtName,handlerMethod,useCapture)
}};
WGGBackbaseEventsManager.prototype.removeEventListener=function(){if(arguments==null){throw"arguments must not be null"
}if(arguments.length!=2){throw"arguments.length should be 2 (type, useCapture)"
}var type=arguments[0];
if(!WGGDataTypeUtils.isString(type)){throw"type should be a String object"
}var useCapture=arguments[1];
if(!WGGDataTypeUtils.isBoolean(useCapture)){throw"useCapture should be a Boolean object"
}var handlerMethod=this.handlerMethodCache[type];
var useCapture=this.handlerCaptureCache[type]||false;
if(!handlerMethod){return false
}if(!WGGDataTypeUtils.isFunction(handlerMethod)){return false
}if(this.bbObject.modelNode!=null){this.bbObject.removeEventListener(type,handlerMethod,useCapture)
}delete this.handlerMethodCache[type];
delete this.handlerCaptureCache[type];
return true
};
WGGBackbaseEventsManager.prototype.hasEventListener=function(type){if(type==null){return false
}return(this.handlerMethodCache[type]!=null)
};
WGGBackbaseEventsManager.prototype.finalize=function(){var j=0;
for(var type in this.handlerMethodCache){var useCapture=this.handlerCaptureCache[type];
if(this.removeEventListener(type,useCapture)){j++
}}this.bbObject=null;
this.handler=null;
this.handlerMethodCache=null;
this.handlerCaptureCache=null;
this.debugInterface=null;
j+=5;
return j
};
WGGBackbaseEventsManager.finalize=function(eventsManagers){if(eventsManagers==null){return 0
}if(!WGGDataTypeUtils.isArray(eventsManagers)){return 0
}var j=0;
while(eventsManagers.length>0){var em=eventsManagers.pop();
if(em){j+=em.finalize();
em=null
}}return j
};
function WGGBackbaseWaitMessageBox(parentDomElement,id,message,messageBoxClassName){this.parentDomElement=parentDomElement;
this.id=id;
this.message=(message!=null)?message:WGGBackbaseWaitMessageBox.MESSAGE;
this.messageBoxClassName=messageBoxClassName;
this.divDef='<div xmlns="http://www.w3.org/1999/xhtml" id="waitMessageBox_{{autoid0}}" style="position:absolute;overflow:hidden;" class="{{css_class_name}}"><div id="waitMessageBox2_{{autoid1}}" style="position:absolute;top:50%;vertical-align:middle;text-align:center;width:100%;"><div id="waitMessageBox3_{{autoid2}}" style="position:relative;top:-50%;text-align:center;margin-left:auto;margin-right:auto;width:200px;">{{lng_wait_message_box_text}}</div></div></div>';
this.bbElement=null;
this.iframes=[];
this.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){this.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){this.debugInterface=new WGGNullDebugInterface()
}this.initialize()
}WGGBackbaseWaitMessageBox.prototype.preInitialize=function(){};
WGGBackbaseWaitMessageBox.prototype.postInitialize=function(){};
WGGBackbaseWaitMessageBox.prototype.initialize=function(){this.preInitialize();
this.initializeBbElement();
this.postInitialize()
};
WGGBackbaseWaitMessageBox.prototype.initializeBbElement=function(){var divDefTemplate=new WGGSimpleTemplate(this.divDef);
divDefTemplate.assign(this.id,"autoid0");
divDefTemplate.assign(this.id,"autoid1");
divDefTemplate.assign(this.id,"autoid2");
divDefTemplate.assign(this.message,"lng_wait_message_box_text");
divDefTemplate.assign(this.messageBoxClassName,"css_class_name");
this.bbElement=bb.command.create(divDefTemplate.getResult(),this.parentDomElement,"appendChild");
var dim=WGGGUIUtils.getDimension(this.parentDomElement.viewNode);
var pos=WGGGUIUtils.getRelativePosition(this.parentDomElement.viewNode);
this.bbElement.viewNode.style.height=dim.height+"px";
this.bbElement.viewNode.style.width=dim.width+"px";
this.bbElement.viewNode.style.top=pos.top+"px";
this.bbElement.viewNode.style.left=pos.left+"px"
};
WGGBackbaseWaitMessageBox.prototype.show=function(){if(this.bbElement==null){return
}if(this.bbElement.modelNode==null){return
}this.bbElement.viewNode.style.display="block"
};
WGGBackbaseWaitMessageBox.prototype.hide=function(){if(this.bbElement==null){return
}if(this.bbElement.modelNode==null){return
}this.bbElement.viewNode.style.display="none"
};
WGGBackbaseWaitMessageBox.prototype.finalize=function(){if(this.bbElement==null){return
}if(this.bbElement.modelNode==null){return
}bb.command.destroy(this.bbElement)
};
WGGBackbaseWaitMessageBox.MESSAGE="Please wait";
function WGGCaretDetector(name){this.input=null;
if(name){var input=document.getElementsByName(name);
if(input==null||input.length==0){input=document.getElementById(name)
}if(input==null||input.length==0){return
}if(input.length>0){this.input=input[0]
}else{this.input=input
}}}WGGCaretDetector.prototype.doGetCaretPosition=function(){var iCaretPos=0;
if(WGGBrowserDetector.IS_IE){this.input.focus();
var oSel=document.selection.createRange();
oSel.moveStart("character",-this.input.value.length);
iCaretPos=oSel.text.length
}else{if(this.input.selectionStart||this.input.selectionStart=="0"){iCaretPos=this.input.selectionStart
}}return(iCaretPos)
};
WGGCaretDetector.prototype.doSetCaretPosition=function(iCaretPos){if(WGGBrowserDetector.IS_IE){this.input.focus();
var oRange=this.input.createTextRange();
oRange.moveStart("character",iCaretPos);
oRange.moveEnd("character",iCaretPos-this.input.value.length);
oRange.select()
}else{if(this.input.selectionStart||this.input.selectionStart=="0"){this.input.selectionStart=iCaretPos;
this.input.selectionEnd=iCaretPos;
this.input.focus()
}}};
function WGGCssRulesManager(doc){this.styleSheets=null;
this.doc=doc;
this.initialize=function(doc){this.styleSheets=doc.styleSheets
};
this.initialize(doc)
}WGGCssRulesManager.prototype.getStyleSheetByName=function(styleSheetName){if(styleSheetName==null||styleSheetName==""){return null
}var _styleSheetName=styleSheetName.toLowerCase();
if(this.styleSheets!=null){for(var i=0;
i<this.styleSheets.length;
i++){if(this.styleSheets[i].href==null){continue
}var _href=this.styleSheets[i].href.toLowerCase();
if(_href.lastIndexOf(_styleSheetName)==(_href.length-_styleSheetName.length)){return this.styleSheets[i]
}}}return null
};
WGGCssRulesManager.prototype.getStyleSheets=function(){return this.styleSheets
};
WGGCssRulesManager.prototype.getStyleSheetRules=function(styleSheetName){var styleSheet=this.getStyleSheetByName(styleSheetName);
if(styleSheet==null){return null
}var rules=new Array();
if(styleSheet.cssRules){rules=styleSheet.cssRules
}else{if(styleSheet.rules){rules=styleSheet.rules
}}WGGAbstractDebugInterface.gDebugInterface.debug(rules);
return rules
};
WGGCssRulesManager.prototype.getStyleSheetRule=function(styleSheetName,ruleName){WGGAbstractDebugInterface.gDebugInterface.debug("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  method getStyleSheetRule ");
if(ruleName==null){return null
}WGGAbstractDebugInterface.gDebugInterface.debug("styleSheetName: "+styleSheetName);
if(styleSheetName==null){return null
}var rules=this.getStyleSheetRules(styleSheetName);
if(rules==null){return null
}WGGAbstractDebugInterface.gDebugInterface.debug("rules: "+rules.length);
var soundexRuleName=ruleName;
if(WGGBrowserDetector.IS_IE){soundexRuleName=ruleName.replace(/(^|,|, |\\s)([a-zA-Z]+\.)/g,function($0,$1){return($1!=-1)?$0.toUpperCase():$2
})
}WGGAbstractDebugInterface.gDebugInterface.debug("soundexRuleName: "+soundexRuleName);
var selectedRules=new Array();
for(var i=0;
i<rules.length;
i++){var rule=rules[i];
var elements=rule.selectorText.split(",");
for(var j=0;
j<elements.length;
j++){var element=WGGStringUtils.trim(elements[j]);
if(element==soundexRuleName){selectedRules.push(rules[i]);
WGGAbstractDebugInterface.gDebugInterface.debug("------------------ selectedRule:");
WGGAbstractDebugInterface.gDebugInterface.debug(rules[i])
}}}return selectedRules
};
WGGCssRulesManager.prototype.insertStyleSheetRule=function(styleSheetName,ruleNames,ruleContents,bReplaceExistingRules){if(ruleNames==null){throw new Error("ruleNames must not be null")
}if(ruleContents==null){throw new Error("ruleContents must not be null")
}if(!WGGDataTypeUtils.isArray(ruleNames)){throw new Error("ruleNames should be an array")
}if(!WGGDataTypeUtils.isArray(ruleContents)){throw new Error("ruleContents should be an array")
}if(ruleNames.length!=ruleContents.length){throw new Error("ruleNames.length != ruleContents.length")
}if(!this.styleSheets){return
}var heads=this.doc.getElementsByTagName("head");
if(heads.length==0){return
}var head=heads[0];
var stylesheet;
var mediaType;
if(this.styleSheets.length>0){for(var i=0;
i<this.styleSheets.length;
i++){if(this.styleSheets[i].disabled){continue
}var media=this.styleSheets[i].media;
mediaType=typeof media;
if(mediaType=="string"){if(media==""||media.indexOf("screen")!=-1){styleSheet=this.doc.styleSheets[i]
}}else{if(mediaType=="object"){if(media.mediaText==""||media.mediaText.indexOf("screen")!=-1){styleSheet=this.doc.styleSheets[i]
}}}if(typeof styleSheet!="undefined"){break
}}}if(typeof styleSheet=="undefined"){var styleSheetElement=this.doc.createElement("style");
styleSheetElement.type="text/css";
head.appendChild(styleSheetElement);
for(var i=0;
i<this.styleSheets.length;
i++){if(this.styleSheets[i].disabled){continue
}styleSheet=this.styleSheets[i]
}var media=styleSheet.media;
mediaType=typeof media
}var rules=null;
if(mediaType=="string"){styleSheet.rules
}else{if(mediaType=="object"){styleSheet.cssRules
}else{return
}}for(var i=0;
i<ruleNames.length;
i++){var ruleName=ruleNames[i].toLowerCase();
var ruleContent=ruleContents[i];
var bFound=false;
if(bReplaceExistingRules===true){for(var j=0;
j<styleSheet.rules.length;
j++){var _ruleName=styleSheet.rules[j].selectorText.toLowerCase();
if(ruleName==_ruleName){styleSeet.rules[j].style.cssText=ruleContent;
bFound=true;
break
}}}if(!bFound){if(mediaType=="string"){styleSheet.addRule(ruleName,ruleContent)
}else{if(mediaType=="object"){styleSheet.insertRule(ruleName+"{"+ruleContent+"}",styleSheet.cssRules.length)
}}}}};
WGGCssRulesManager.prototype.getPropertyValue=function(styleSheetName,ruleName,propertyName,retRules,retPropertyValues){var selectedRules=this.getStyleSheetRule(styleSheetName,ruleName);
if(selectedRules==null){return
}for(var i=0;
i<selectedRules.length;
i++){var selectedRule=selectedRules[i];
var style=selectedRule.style;
var propertyValue=style[propertyName];
retRules.push(selectedRule);
retPropertyValues.push(propertyValue)
}};
WGGCssRulesManager.prototype.setPropertyValue=function(styleSheetName,ruleName,propertyName,newValue){var rules=new Array();
var propertyValues=new Array();
this.getPropertyValue(styleSheetName,ruleName,propertyName,rules,propertyValues);
for(var i=0;
i<rules.length;
i++){var rule=rules[i];
rule.style[propertyName]=newValue
}};
function WGGDateInputValidator(name,format,displayValue,invalidValueInserted){this.format=format;
this.displayValue=displayValue;
this.name=name;
this.onInsertInvalidValue=null;
if(invalidValueInserted!=null){if(!WGGDataTypeUtils.isFunction(invalidValueInserted)){throw"invalidValueInserted should be a Function"
}this.onInsertInvalidValue=invalidValueInserted
}this.caretDetector=new WGGCaretDetector(name);
this.initialize()
}WGGDateInputValidator.prototype.getDateParts=function(userInput){for(var i=0;
i<WGGDateInputValidator.sepPlaceholders.length;
i++){var sepPlaceholder=WGGDateInputValidator.sepPlaceholders[i];
var parts=userInput.split(sepPlaceholder);
if(parts.length>1){return parts
}}return[userInput]
};
WGGDateInputValidator.prototype.isUserInputValid=function(userInput){var dateParts=this.getDateParts(userInput);
return(dateParts.length==3)
};
WGGDateInputValidator.prototype.fireInvalidValueInserted=function(){var args=[];
for(var i=0;
i<arguments.length;
i++){args[i]=arguments[i]
}if(this.onInsertInvalidValue!=null){this.onInsertInvalidValue.apply(this,args)
}};
WGGDateInputValidator.prototype.completeUserInput=function(userInput){if(userInput==null){return null
}if(userInput.length==this.format.length){return userInput
}WGGAbstractDebugInterface.gDebugInterface.debug("///////////////////////////////////////////////////////////////");
WGGAbstractDebugInterface.gDebugInterface.debug("format:"+this.format);
WGGAbstractDebugInterface.gDebugInterface.debug("userInput:"+userInput);
WGGAbstractDebugInterface.gDebugInterface.debug("appended:"+userInput+this.format.substring(userInput.length));
WGGAbstractDebugInterface.gDebugInterface.debug("///////////////////////////////////////////////////////////////");
return userInput+this.format.substring(userInput.length)
};
WGGDateInputValidator.prototype.finalize=function(){var input=document.getElementsByName(this.name);
if(!input){return
}input.__inputValidatorRef=null;
delete input.__inputValidatorRef
};
WGGDateInputValidator.prototype.initialize=function(){if(!this.name){return
}var input=document.getElementsByName(name);
if(input==null){return
}if(input.length==null){return
}var input=input[0];
input.__inputValidatorRef=this;
if(input!=null){var isValid=false;
for(var i=0;
i<WGGDateInputValidator.validFormats.length;
i++){if(WGGDateInputValidator.validFormats[i]==this.format){isValid=true;
break
}}if(!isValid){format=WGGDateInputValidator.validFormats[0]
}if(this.displayValue==null||this.displayValue==""){input.onfocus=function(e){if(this.value==""){this.value=this.__inputValidatorRef.format
}this.__inputValidatorRef.caretDetector.doSetCaretPosition(0)
};
input.onblur=function(e){if(this.value==this.__inputValidatorRef.format){this.value=""
}else{if(this.value==""){}else{var dateParts=this.__inputValidatorRef.getDateParts(this.value);
if(!this.__inputValidatorRef.isUserInputValid(this.value)){fireInvalidValueInserted(this.value,{day:null,month:null,year:null});
return
}var month=Number(dateParts[1]);
var day=(dateParts[0].length==4)?Number(dateParts[2]):Number(dateParts[0]);
var year=(dateParts[0].length==4)?Number(dateParts[0]):Number(dateParts[2]);
if(month<1||month>12){this.__inputValidatorRef.fireInvalidValueInserted(this.value,{day:day,month:month,year:year});
return
}if(day<1||day>31){this.__inputValidatorRef.fireInvalidValueInserted(this.value,{day:day,month:month,year:year});
return
}}}}
}input.onkeyup=function(e){};
input.onkeydown=function(e){var myEvent=window.event||e;
var usrKeyCode=myEvent.keyCode||myEvent.which;
return(!(usrKeyCode==46&&WGGBrowserDetector.IS_IE))
};
input.onkeypress=function(e){WGGAbstractDebugInterface.gDebugInterface.debug("~~~~~~~~~~~ onKeyPress");
var myEvent=window.event||e;
var obj=myEvent.srcElement||myEvent.target;
var usrKeyCode=myEvent.keyCode||myEvent.which;
var usrCharCode=WGGBrowserDetector.IS_IE?myEvent.keyCode:myEvent.charCode;
var usrChar=WGGStringUtils.chr(usrCharCode);
WGGAbstractDebugInterface.gDebugInterface.debug("usrKeyCode => usrCharCode => usrChar : "+usrKeyCode+"=>"+usrCharCode+"=>"+usrChar);
if(this.value.length>this.__inputValidatorRef.format.length){return false
}if(usrKeyCode==8||usrKeyCode==36||usrKeyCode==39||usrKeyCode==37){return true
}else{if(WGGDateInputValidator.isSepPlaceholderValid(usrChar)){if(this.__inputValidatorRef.format.indexOf(usrChar)!=-1){var caretPos=this.__inputValidatorRef.caretDetector.doGetCaretPosition();
if(this.__inputValidatorRef.format.charAt(caretPos)==usrChar){if(this.value.charAt(caretPos)==usrChar){this.__inputValidatorRef.caretDetector.doSetCaretPosition(caretPos+1);
return false
}}}}else{if(!(usrKeyCode>47&&usrKeyCode<58)){return false
}}}var caretPos=this.__inputValidatorRef.caretDetector.doGetCaretPosition();
var nextChar=this.__inputValidatorRef.format.charAt(caretPos);
if(WGGDateInputValidator.isSepPlaceholderValid(nextChar)){var tmp=this.value.substring(0,caretPos+1);
if((caretPos+2)<this.value.length){tmp+=this.value.substring(caretPos+2)
}else{if(!WGGDateInputValidator.isSepPlaceholderValid(usrChar)){tmp+=nextChar
}}this.value=tmp;
this.__inputValidatorRef.caretDetector.doSetCaretPosition(caretPos+1)
}else{if(WGGDateInputValidator.isSepPlaceholderValid(usrChar)){return false
}var tmp=this.value.substring(0,caretPos);
if((caretPos+1)<this.value.length){tmp+=this.value.substring(caretPos+1)
}this.value=tmp;
this.__inputValidatorRef.caretDetector.doSetCaretPosition(caretPos)
}if(this.value.length>=this.__inputValidatorRef.format.length){return false
}return true
}
}};
WGGDateInputValidator.isSepPlaceholderValid=function(sepPlaceholder){if(sepPlaceholder==null){return false
}for(var i=0;
i<WGGDateInputValidator.sepPlaceholders.length;
i++){if(WGGDateInputValidator.sepPlaceholders[i]==sepPlaceholder){return true
}}return false
};
WGGDateInputValidator.numPlaceholder="_";
WGGDateInputValidator.sepPlaceholders=["-",".","/"];
WGGDateInputValidator.validFormats=["____-__-__","__.__.____","__-__-____","__/__/____"];
function WGGDebugWindow(name,options){try{if(typeof console.log!="undefined"){return
}}catch(e){}this.name=name;
this.options=options;
if(this.name==null){this.name="debugWindow"
}this.name=this.name.replace(/[^a-zA-Z_]+/g,"")+"_"+(new Date()).getTime();
this.win=null;
this.doc=null;
this.body=null;
this.popupBlockerHintShown=false;
this.menue=null;
var messageTypeFontColors={};
messageTypeFontColors[WGGAbstractDebugInterface.MESSAGE_TYPE_ERROR]="red";
messageTypeFontColors[WGGAbstractDebugInterface.MESSAGE_TYPE_WARN]="blue";
messageTypeFontColors[WGGAbstractDebugInterface.MESSAGE_TYPE_DEBUG]="green";
messageTypeFontColors[WGGAbstractDebugInterface.MESSAGE_TYPE_INFO]="brown";
var __replaceChars=function(str,regexp,options,replacement){var pattern=new RegExp(regexp,options);
return str.replace(pattern,replacement)
};
this.prepareTypeView=function(type){return'<font color="'+messageTypeFontColors[type]+'" size="+1"><b>'+__replaceChars(WGGStringUtils.leftPad(type," ",5)+": "," ","g","&nbsp;")+"</b></font>"
};
this.prepareStrategies={string:function __prepareString(type,str,parentDiv){var result=str;
result=__replaceChars(result," ","g","&nbsp;");
result=__replaceChars(result,"\\<","gm","&lt;");
result=__replaceChars(result,"\\>","gm","&gt;");
result=__replaceChars(result,"\n|\r\n","gm","<br>");
var callerStringPattern=new RegExp("(caller:)((&nbsp;)?\\[\\[\\[.*\\]\\]\\])","gm");
var result=result.replace(callerStringPattern,function(capturedStr,fCapturedStr,sCapturedStr,offset,str){if(capturedStr==""){return str
}return'<div style="margin-left:70px;"><b>'+fCapturedStr+"</b>"+sCapturedStr+"</div>"
},"gmi");
var detailsPattern=new RegExp("\\[\\[\\[.*?\\]\\]\\]","g");
result=result.replace(detailsPattern,function($0,$1){return($1!=-1)?"<input type=\"button\" style=\"padding:0px;width:20px;height:20px;display:inline;\" value=\"+\" onclick=\"javascript: var s = this.nextSibling.style; var d = s.display; s.display = ((d =='none') ? 'block' : 'none'); this.value=((this.value =='+') ? '-' : '+')\"><pre style=\"display:none; background:lightyellow;\">"+$0+"</pre>":$2
});
parentDiv.innerHTML+=result
},object:function __prepareObject(type,obj,parentDiv){var _debuggedObj=obj.object;
var _caller=obj.caller;
var treeDiv=this.doc.createElement("div");
treeDiv.style.marginLeft="70px";
parentDiv.appendChild(treeDiv);
var factory=WGGAbstractGUIStuffFactory.createFactory("simple0");
factory.createTree(this.doc,treeDiv,_debuggedObj);
var callerDiv=this.doc.createElement("div");
this.prepareStrategies.string.call(this,type,_caller,callerDiv);
parentDiv.appendChild(callerDiv)
}};
this.initialize()
}WGGDebugWindow.prototype.showPopupHint=function(){if(!this.popupBlockerHintShown){alert("please, deactivate the popup blocker in order to use WGGDebugWindow");
this.popupBlockerHintShown=true
}};
WGGDebugWindow.prototype.initialize=function(){var self=this;
this.win=window.open("",this.name,this.options);
if(!(this.win&&!this.win.closed)){this.showPopupHint();
return
}this.doc=this.win.document;
if(!this.doc.getElementsByTagName){this.showPopupHint();
return
}this.doc.title=this.win.name;
var body=this.doc.getElementsByTagName("BODY");
if(body!=null){this.body=body[0];
WGGGUIUtils.extendStyle(this.body,{fontFamily:"monospace",fontSize:"8pt",padding:"0px"});
if(!WGGBrowserDetector.IS_IE){this.body.innerHTML='<style type="text/css">div.simpleTreeDiv{margin-left:10px;border-left:1px dotted red;padding-left:10px;} a {cursor:pointer;} a:hover{background-color:lightblue;}</style>'
}else{var styleSheet=this.doc.createStyleSheet();
styleSheet.cssText="DIV.simpleTreeDiv{ margin-left: 10px; border-left: 1px dotted red; padding-left: 10px; } A {cursor:pointer;} A:hover {background-color:lightblue;}"
}}this.menue=new WGGDebugWindow.DebugMenue(this);
var repaintMenueFunction=function(){self.menue.repaint()
};
if(WGGBrowserDetector.IS_IE){this.body.onscroll=repaintMenueFunction;
this.body.onresize=repaintMenueFunction
}else{this.win.onscroll=repaintMenueFunction;
this.win.onresize=repaintMenueFunction
}};
WGGDebugWindow.prototype.stateChanged=function(changeEvent){var source=changeEvent.getSource();
var messageType=source.type;
var messageText=source.text;
if(this.win==null){this.initialize()
}if(this.win!=null){if(this.win.closed){this.initialize()
}}if(this.win==null){return
}var div=this.doc.createElement("div");
this.body.appendChild(div),div.name=messageType;
div.style.borderTop="1px dashed orange";
div.innerHTML=this.prepareTypeView(messageType);
var strategy=null;
if(WGGDataTypeUtils.isString(messageText)){strategy=this.prepareStrategies.string
}else{var _object=messageText.object;
var _caller=messageText.caller;
if(typeof _caller!="string"){alert("sorry cannot handle callers of type "+(typeof _caller)+" (should be a string)")
}if(typeof _object=="string"){strategy=this.prepareStrategies.string;
messageText=_object+";"+_caller
}else{strategy=this.prepareStrategies.object
}}strategy.call(this,messageType,messageText,div)
};
WGGDebugWindow.DebugMenue=function(parentDebugWindow){this.parent=parentDebugWindow;
this.win=this.parent.win;
this.doc=this.parent.doc;
this.body=this.parent.body;
this.menueDiv=null;
this.searchTextRange=null;
this.foundTextHighlightDiv=null;
var self=this;
this.defineMenueDivStyle=function(){return{fontFamily:"Arial",fontSize:"8pt",position:"absolute",width:"430px",padding:"5px",border:"5px solid #DCE4EE",background:"#EAEEF2",MozOpacity:"0.8",filter:"alpha(opacity=80)"}
};
this.defineFoundTextHighlightDivStyle=function(){return{position:"absolute",zIndex:-1,backgroundColor:"green",border:"1px solid green",MozOpacity:"0.6",filter:"alpha(opacity=60)",display:"none"}
};
this.defineHeaderDivStyle=function(){return{fontSize:"10px",fontWeight:"bold",cssFloat:"left",styleFloat:"left",width:"85%"}
};
this.defineShowHideMenueButtonDivStyle=function(){return{cssFloat:"right",styleFloat:"right",width:"26px"}
};
this.defineShowHideMenueButtonStyle=function(){return{width:"25px",fontSize:"8pt",width:"20px",height:"70px",verticalAlign:"middle"}
};
this.defineCopyToClipboardButtonStyle=function(){return{fontSize:"8pt"}
};
this.hideFoundTextHighlightDivStyle=function(){WGGGUIUtils.extendStyle(self.foundTextHighlightDiv,{display:"none",zIndex:-1})
};
this.getKeyPressSearchStrategy=function(){if(WGGBrowserDetector.IS_IE){return function __ieSpecificSearch(input){if(input==null){return
}var word=input.value;
if(word==null){return
}if(word.length==0){return
}if(this.searchTextRange==null){this.searchTextRange=this.body.createTextRange()
}else{this.searchTextRange.moveStart("character",word.length);
this.searchTextRange.moveEnd("textedit")
}var bFound=this.searchTextRange.findText(word);
if(bFound){this.searchTextRange.scrollIntoView();
var rect=this.searchTextRange.getBoundingClientRect();
var sLeft=WGGGUIUtils.getScrollLeft(this.doc);
var sTop=WGGGUIUtils.getScrollTop(this.doc);
WGGGUIUtils.extendStyle(this.foundTextHighlightDiv,{top:(rect.top+sTop-2)+"px",left:(rect.left+sLeft-2)+"px",width:(rect.right-rect.left+2)+"px",height:(rect.bottom-rect.top+2)+"px",zIndex:1,display:"block"})
}else{this.searchTextRange=this.body.createTextRange();
var bSearchAgain=confirm("End of document reached; do you want to start the search again?");
this.win.focus();
input.focus();
if(bSearchAgain){__ieSpecificSearch.call(self,input)
}}}
}return null
};
this.getKeyDownSearchStrategy=function(){if(WGGBrowserDetector.IS_NAV){return function __navSpecificSearch(input){if(input==null){return
}self.win.find(input.value,false)
}
}return null
};
this.initialize=function(){this.menueDiv=this.doc.createElement("div");
this.menueDiv.name="menue";
WGGGUIUtils.extendStyle(this.menueDiv,this.defineMenueDivStyle());
this.body.appendChild(this.menueDiv);
var header=this.doc.createElement("div");
WGGGUIUtils.extendStyle(header,this.defineHeaderDivStyle());
header.appendChild(this.doc.createTextNode("DEBUGGING WINDOW '"+this.win.name+"' at "+new Date().toLocaleString()));
this.menueDiv.appendChild(header);
var showHideMenueButtonDiv=this.doc.createElement("div");
WGGGUIUtils.extendStyle(showHideMenueButtonDiv,this.defineShowHideMenueButtonDivStyle());
var showHideMenueButton=this.doc.createElement("button");
WGGGUIUtils.extendStyle(showHideMenueButton,this.defineShowHideMenueButtonStyle());
showHideMenueButton.innerHTML="&#8594;";
showHideMenueButton.hidden=false;
showHideMenueButton.onclick=function(e){var targetWidth=(this.hidden)?430:80;
var startWidth=(this.hidden)?80:430;
var step=(this.hidden)?50:-50;
var animateHandle=null;
function __setVisibility(buttonRef){var childNodes=self.menueDiv.childNodes;
for(var i=0;
i<childNodes.length;
i++){if(!childNodes[i]){continue
}if(childNodes[i]==buttonRef||childNodes[i]==buttonRef.parentNode){continue
}WGGGUIUtils.extendStyle(childNodes[i],{display:(buttonRef.hidden)?"inline":"none"})
}}function __animate(buttonRef,newWidth){WGGGUIUtils.extendStyle(self.menueDiv,{width:newWidth+"px"});
self.repaint();
if(newWidth==targetWidth){if(buttonRef.hidden){__setVisibility(buttonRef)
}buttonRef.hidden=!buttonRef.hidden;
buttonRef.innerHTML=(buttonRef.hidden)?"&#8592;":"&#8594;";
clearTimeout(animateHandle);
return
}newWidth+=step;
animateHandle=setTimeout(function(){__animate(buttonRef,newWidth)
},5)
}if(!this.hidden){__setVisibility(this)
}__animate(this,startWidth)
};
showHideMenueButtonDiv.appendChild(showHideMenueButton);
this.menueDiv.appendChild(showHideMenueButtonDiv);
this.menueDiv.appendChild(this.doc.createElement("br"));
this.menueDiv.appendChild(this.doc.createElement("br"));
this.menueDiv.appendChild(this.doc.createElement("br"));
var searchField=this.doc.createElement("input");
searchField.type="text";
searchField.onkeydown=function(e){var f=self.getKeyDownSearchStrategy();
if(f!=null){f.call(self,this)
}return true
};
searchField.onkeypress=function(e){var myEvent=self.win.event||e;
var usrKeyCode=myEvent.keyCode||myEvent.which;
var f=self.getKeyPressSearchStrategy();
if(usrKeyCode==13){if(f!=null){f.call(self,this)
}else{}}return true
};
var span0=this.doc.createElement("span");
span0.appendChild(this.doc.createTextNode("Search text:"));
this.menueDiv.appendChild(span0);
this.menueDiv.appendChild(searchField);
this.foundTextHighlightDiv=this.doc.createElement("div");
WGGGUIUtils.extendStyle(this.foundTextHighlightDiv,this.defineFoundTextHighlightDivStyle());
this.body.appendChild(this.foundTextHighlightDiv);
var filterSelectBox=this.doc.createElement("select");
var allEntries=["[all]"].concat(WGGAbstractDebugInterface.MESSAGE_TYPES);
var allEntriesArr=new WGGArray(allEntries);
for(var i in allEntries){var messageType=allEntries[i];
var option=this.doc.createElement("option");
option.appendChild(this.doc.createTextNode(messageType));
option.value=messageType;
filterSelectBox.appendChild(option)
}filterSelectBox.onchange=function(){self.hideFoundTextHighlightDivStyle();
var selectedValue=this.options[this.selectedIndex].value;
var messageDivs=self.doc.getElementsByTagName("div");
for(var i=0;
i<messageDivs.length;
i++){var messageDiv=messageDivs[i];
if(!allEntriesArr.contains(messageDiv.name)){continue
}if(selectedValue=="[all]"){WGGGUIUtils.extendStyle(messageDiv,{display:"block"});
continue
}if(messageDiv.name==selectedValue){WGGGUIUtils.extendStyle(messageDiv,{display:"block"})
}else{WGGGUIUtils.extendStyle(messageDiv,{display:"none"})
}}};
var span1=this.doc.createElement("span");
span1.appendChild(this.doc.createTextNode(" | Filter:"));
this.menueDiv.appendChild(span1);
this.menueDiv.appendChild(filterSelectBox);
var span2=this.doc.createElement("span");
span2.appendChild(this.doc.createTextNode(" | "));
this.menueDiv.appendChild(span2);
var copyToClipboardButton=this.doc.createElement("button");
WGGGUIUtils.extendStyle(copyToClipboardButton,this.defineCopyToClipboardButtonStyle());
copyToClipboardButton.appendChild(this.doc.createTextNode("Copy"));
copyToClipboardButton.onclick=function(){var copied=WGGGUIUtils.copyToClipboard(self.body.innerHTML);
if(copied){alert("code copied into the clipboard")
}};
this.menueDiv.appendChild(copyToClipboardButton);
this.repaint()
};
this.repaint=function(){try{var cWidth=WGGGUIUtils.getClientWidth(this.doc,false);
var cHeight=WGGGUIUtils.getClientHeight(this.doc,false);
var sLeft=WGGGUIUtils.getScrollLeft(this.doc,false);
var sTop=WGGGUIUtils.getScrollTop(this.doc,false);
var menueDivDimension=WGGGUIUtils.getDimension(this.menueDiv);
var bLeft=cWidth+sLeft-menueDivDimension.width;
var bTop=sTop;
WGGGUIUtils.extendStyle(this.menueDiv,{left:bLeft+"px",top:bTop+"px"})
}catch(e){}};
this.initialize()
};
function WGGEventsManager(handler,el){this.handler=null;
this.el=null;
this.bDontUtilizeRefToEl=(arguments.length>2)?WGGDataTypeUtils.toBoolean(arguments[2]):false;
this.listenersMap=null;
this.debugInterface=null;
this.initialize(handler,el)
}WGGEventsManager.prototype.isEventNameArgValid=function(eventName){return WGGDataTypeUtils.isString(eventName)
};
WGGEventsManager.prototype.isMethodArgValid=function(method){return WGGDataTypeUtils.isFunction(method)
};
WGGEventsManager.prototype.isObjArgValid=function(obj){return(obj==null||WGGDataTypeUtils.isObject(obj))
};
WGGEventsManager.prototype.setEl=function(el){this.el=el
};
WGGEventsManager.prototype.initialize=function(handler,el){this.handler=handler;
this.el=el;
this.listenersMap=new WGGHashMap();
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){this.debugInterface=WGGAbstractDebugInterface.gDebugInterface;
WGGEventsManager.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){this.debugInterface=new WGGNullDebugInterface();
WGGEventsManager.debugInterface=new WGGNullDebugInterface()
}};
WGGEventsManager.prototype.supportsEvent=function(eventName){if(eventName==null){return false
}if(!this.isEventNameArgValid(eventName)){return false
}return this.listenersMap.containsKey(eventName)
};
WGGEventsManager.prototype.addEventListener=function(eventName,handler,handlerMethod){if(eventName==null){return false
}if(handlerMethod==null){return false
}if(this.el==null){return false
}if(!this.isEventNameArgValid(eventName)){return false
}if(!this.isMethodArgValid(handlerMethod)){return false
}if(!this.isObjArgValid(handler)){return false
}var handlerObject={handler:this.handler,handlerMethod:handlerMethod,eventName:eventName};
if(this.el.addEventListener){var f=function(){this.handlerMethod.apply(this.handler,arguments)
}.__wggClosure(handlerObject);
this.el.addEventListener(eventName,f,false);
this.listenersMap.put(eventName,f);
if(this.bDontUtilizeRefToEl){this.el=null
}}else{if(this.el.attachEvent){var f=function(){this.handlerMethod.apply(this.handler,arguments)
}.__wggClosure(handlerObject);
this.el.attachEvent("on"+eventName,f);
this.listenersMap.put(eventName,f);
if(this.bDontUtilizeRefToEl){this.el=null
}}else{throw new Error("attaching event handler not possible (not supported)")
}}return true
};
WGGEventsManager.prototype.addEventListenersMap=function(){var args=Array.prototype.slice.call(arguments);
if(args.length<2){throw"arguments.length should be >= 2"
}var optionalHandlerObject=args[0];
var listenersMap=args[1];
var additionalArgs=(args.length>2)?args.slice(2,args.length):null;
if(listenersMap==null){return false
}for(var evtName in listenersMap){var handlerMethodIdentifier=listenersMap[evtName];
var handlerArr=WGGEventsManager.findHandler([optionalHandlerObject,this.handler],handlerMethodIdentifier);
if(handlerArr==null){continue
}if(!WGGDataTypeUtils.isArray(handlerArr)){continue
}if(handlerArr.length!=2){continue
}var handler=handlerArr[0];
var handlerMethod=handlerArr[1];
var eventListenerArgs=[evtName,handler,handlerMethod].concat(additionalArgs);
this.addEventListener.apply(this,eventListenerArgs)
}};
WGGEventsManager.prototype.removeEventListener=function(eventName){if(eventName==null){return false
}if(!this.supportsEvent(eventName)){return false
}if(!this.hasEventListener(eventName)){return false
}if(this.el==null){WGGAbstractDebugInterface.gDebugInterface.warn("cannot detach the event listener ("+eventName+") because this.el is null");
return true
}else{var f=this.listenersMap.get(eventName);
if(f!=null&&this.el!=null){if(this.el.removeEventListener){this.el.removeEventListener(eventName,f,false);
WGGFinalizer.destroyWggClosuresByAttrs({handler:this.handler,eventName:eventName})
}else{if(this.el.detachEvent){this.el.detachEvent("on"+eventName,f);
WGGFinalizer.destroyWggClosuresByAttrs({handler:this.handler,eventName:eventName})
}else{throw new Error("detaching event handler not possible (not supported)")
}}this.listenersMap.remove(eventName);
return true
}}return false
};
WGGEventsManager.prototype.hasEventListener=function(eventName){if(eventName==null){return false
}if(!this.supportsEvent(eventName)){return false
}return(this.listenersMap.get(eventName)!=null)
};
WGGEventsManager.prototype.finalize=function(){if(this.listenersMap==null){return 0
}var j=0;
var s=this.listenersMap.size();
var it=this.listenersMap.keyIterator();
while(it.hasNext()){var el=it.next();
if(this.removeEventListener(el)){j++
}}this.handler=null;
this.el=null;
this.listenersMap.finalize();
this.debugInterface=null;
j+=4;
return j
};
WGGEventsManager.findHandler=function(handlers,handlerMethodIdentifier){if(handlerMethodIdentifier==null){return[null,null]
}if(handlers==null||handlers.length==0){if(WGGDataTypeUtils.isFunction(handlerMethodIdentifier)){return[null,handlerMethodIdentifier]
}else{return[null,null]
}}var foundHandlerObject=null;
var foundHandlerMethod=null;
for(var i=0;
i<handlers.length;
i++){var handler=handlers[i];
if(WGGDataTypeUtils.isString(handlerMethodIdentifier)){var handlerMethod=handler[handlerMethodIdentifier];
if(WGGDataTypeUtils.isFunction(handlerMethod)){foundHandlerObject=handler;
foundHandlerMethod=handlerMethod;
break
}}else{if(WGGDataTypeUtils.isFunction(handlerMethodIdentifier)){var handlerMethodName=new WGGMethod(handlerMethodIdentifier).getName();
if(handlerMethodName.length>0){if(handler[handlerMethodName]==handlerMethodIdentifier){foundHandlerObject=handler;
foundHandlerMethod=handlerMethodIdentifier;
break
}}else{for(var member in handler){if(handler[member]==handlerMethodIdentifier){foundHandlerObject=handler;
foundHandlerMethod=handlerMethodIdentifier;
break
}}}}else{continue
}}}return[foundHandlerObject,foundHandlerMethod]
};
WGGEventsManager.finalize=function(eventsManagers){if(eventsManagers==null){return 0
}if(!WGGDataTypeUtils.isArray(eventsManagers)){return 0
}var j=0;
while(eventsManagers.length>0){var em=eventsManagers.pop();
if(em){j+=em.finalize();
em=null
}}return j
};
function WGGGUIUtils(){}WGGGUIUtils.getPosition=function(obj){var pos={left:0,top:0};
if(typeof obj.offsetLeft!="undefined"){while(obj){pos.left+=obj.offsetLeft;
pos.top+=obj.offsetTop;
obj=obj.offsetParent
}}else{pos.left=obj.left;
pos.top=obj.top
}return pos
};
WGGGUIUtils.getRelativePosition=function(obj){var pos={left:0,top:0};
pos.left=obj.offsetLeft;
pos.top=obj.offsetTop;
return pos
};
WGGGUIUtils.getDimension=function(obj){var dimension={width:0,height:0};
dimension.width=obj.offsetWidth;
dimension.height=obj.offsetHeight;
return dimension
};
WGGGUIUtils.getClientCoordinates=function(myEvent){var posx=0;
var posy=0;
if(myEvent.pageX||myEvent.pageY){posx=myEvent.pageX;
posy=myEvent.pageY
}else{if(myEvent.clientX||myEvent.clientY){posx=myEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;
posy=myEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop
}}return{x:posx,y:posy}
};
WGGGUIUtils.copyToClipboard=function(text){if(window.clipboardData){return window.clipboardData.setData("text",text)
}else{if(window.netscape){netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var clip=Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);
if(!clip){return
}var trans=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
if(!trans){return
}trans.addDataFlavor("text/unicode");
var str=new Object();
var len=new Object();
var str=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
var copytext=text;
str.data=copytext;
trans.setTransferData("text/unicode",str,copytext.length*2);
var clipid=Components.interfaces.nsIClipboard;
if(!clip){return
}clip.setData(trans,null,clipid.kGlobalClipboard)
}}};
WGGGUIUtils.isVisible=function(obj){if(obj==document){return true
}if(!obj){return false
}if(!obj.parentNode){return false
}if(obj.style){if(obj.style.display=="none"){return false
}if(obj.style.visibility=="hidden"){return false
}}if(window.getComputedStyle){var style=window.getComputedStyle(obj,"");
if(style.display=="none"){return false
}if(style.visibility=="hidden"){return false
}}var style=obj.currentStyle;
if(style){if(style.display=="none"){return false
}if(style.visibility=="hidden"){return false
}}return WGGGUIUtils.isVisible(obj.parentNode)
};
WGGGUIUtils.DimensionsHelper=function(){};
WGGGUIUtils.DimensionsHelper._filterResults=function(winValue,docElementValue,bodyValue,bMaxSignificant){var result=winValue?winValue:0;
if(docElementValue&&(!result)){result=docElementValue
}if(!bodyValue){return result
}if(!result){return bodyValue
}var retVal=null;
if(bMaxSignificant==false){retVal=(result<bodyValue)?result:bodyValue
}else{retVal=(result>bodyValue)?result:bodyValue
}return retVal
};
WGGGUIUtils.getClientWidth=function(doc,bMaxSignificant){if(!doc){doc=document
}if(!bMaxSignificant){bMaxSignificant=false
}return WGGGUIUtils.DimensionsHelper._filterResults(window.innerWidth?window.innerWidth:0,doc.documentElement?doc.documentElement.clientWidth:0,doc.body?doc.body.clientWidth:0,bMaxSignificant)
};
WGGGUIUtils.getClientHeight=function(doc,bMaxSignificant){if(!doc){doc=document
}if(!bMaxSignificant){bMaxSignificant=false
}return WGGGUIUtils.DimensionsHelper._filterResults(window.innerHeight?window.innerHeight:0,doc.documentElement?doc.documentElement.clientHeight:0,doc.body?doc.body.clientHeight:0,bMaxSignificant)
};
WGGGUIUtils.getScrollLeft=function(doc,bMaxSignificant){if(!doc){doc=document
}if(!bMaxSignificant){bMaxSignificant=false
}return WGGGUIUtils.DimensionsHelper._filterResults(window.pageXOffset?window.pageXOffset:0,doc.documentElement?doc.documentElement.scrollLeft:0,doc.body?doc.body.scrollLeft:0,bMaxSignificant)
};
WGGGUIUtils.getScrollTop=function(doc,bMaxSignificant){if(!doc){doc=document
}if(!bMaxSignificant){bMaxSignificant=false
}return WGGGUIUtils.DimensionsHelper._filterResults(window.pageYOffset?window.pageYOffset:0,doc.documentElement?doc.documentElement.scrollTop:0,doc.body?doc.body.scrollTop:0,bMaxSignificant)
};
WGGGUIUtils.extendStyle=function(obj,styleDef){if(obj==null){return
}if(obj.style==null){return
}if(styleDef==null){return
}for(var styleAttr in styleDef){obj.style[styleAttr]=styleDef[styleAttr]
}};
WGGGUIUtils.estimateFontDimensions=function(){if(arguments.length==0){return
}var obj=arguments[0];
if(obj==null){return
}if(obj.firstChild==null){return
}if(obj.firstChild.nodeType!=3){return
}var width=parseInt(obj.offsetWidth);
var height=parseInt(obj.offsetHeight);
var parent=obj.parentNode;
if(parent!=null){while(true){if(parent==null){break
}if(parent.tagName=="BODY"){break
}var parentWidth=parseInt(parent.offsetWidth);
var parentHeight=parseInt(parent.offsetHeigth);
if(parentWidth<width){width=parentWidth
}if(parentHeight<height){height=parentHeight
}parent=parent.parentNode
}}var text=null;
if(arguments.length>1){if(arguments[1]!=null){if(WGGDataTypeUtils.isString(arguments[1])){text=arguments[1]
}else{text=obj.firstChild.nodeValue
}}}if(text==null){throw"WGGGUIUtils.estimateFontDimensions: no text found for the element ("+obj.nodeName+")"
}var len=text.length;
var paddingLeft=0,paddingRight=0,paddingTop=0,paddingBottom=0;
if(!WGGDataTypeUtils.isUndefined(obj.style.paddingLeft)){paddingLeft=parseInt(obj.style.paddingLeft);
if(isNaN(paddingLeft)){paddingLeft=0
}}if(!WGGDataTypeUtils.isUndefined(obj.style.paddingRight)){paddingRight=parseInt(obj.style.paddingRight);
if(isNaN(paddingRight)){paddingRight=0
}}if(!WGGDataTypeUtils.isUndefined(obj.style.paddingTop)){paddingTop=parseInt(obj.style.paddingTop);
if(isNaN(paddingTop)){paddingTop=0
}}if(!WGGDataTypeUtils.isUndefined(obj.style.paddingBottom)){paddingBottom=parseInt(obj.style.paddingBottom);
if(isNaN(paddingBottom)){paddingBottom=0
}}var innerWidth=width-paddingLeft-paddingRight;
var innerHeight=height-paddingTop-paddingBottom;
var charWidth=0;
if(len!=0){charWidth=Math.floor(innerWidth/len)
}var charHeight=innerHeight;
var optLength=0;
if(charWidth!=0){optLength=Math.floor(innerWidth/charWidth)
}return{width:width,height:height,innerWidth:innerWidth,innerHeight:innerHeight,text:text,textLength:len,optLength:optLength,charWidth:charWidth,charHeight:charHeight}
};
WGGGUIUtils.getChildNodes=function(parentNode,nodeName,idRegExp,bDeepSearch){if(parentNode==null){return null
}if(nodeName!=null){nodeName=nodeName.toUpperCase()
}var retChildNodes=[];
for(var i=0;
i<parentNode.childNodes.length;
i++){var childNode=parentNode.childNodes[i];
if(!childNode.tagName){continue
}if(childNode.tagName.toUpperCase()!=nodeName){if(bDeepSearch){var retChildNodeFromChild=WGGGUIUtils.getChildNodes(childNode,nodeName,idRegExp,bDeepSearch);
if(retChildNodeFromChild!=null){retChildNodes=retChildNodes.concat(retChildNodeFromChild)
}}}else{if(idRegExp==null){retChildNodes.push(childNode)
}else{var id=childNode.id;
if(id!=""){if(idRegExp.exec(id)){retChildNodes.push(childNode)
}}}if(bDeepSearch){var retChildNodeFromChild=WGGGUIUtils.getChildNodes(childNode,nodeName,idRegExp,bDeepSearch);
if(retChildNodeFromChild!=null){retChildNodes=retChildNodes.concat(retChildNodeFromChild)
}}}}return retChildNodes
};
WGGGUIUtils.getFirstChildNode=function(parentNode,nodeName,idRegExp,bDeepSearch){var foundChildNodes=WGGGUIUtils.getChildNodes(parentNode,nodeName,idRegExp,bDeepSearch);
if(foundChildNodes==null){return null
}if(foundChildNodes.length==0){return null
}return foundChildNodes[0]
};
WGGGUIUtils.getParentNode=function(childNode,nodeName,idRegExp){if(childNode==null){return null
}if(nodeName==null){return null
}nodeName=nodeName.toUpperCase();
var retParentNode=null;
var parentNode=childNode.parentNode;
while(parentNode!=null){if(parentNode.nodeName.toUpperCase()==nodeName){if(idRegExp==null){retParentNode=parentNode;
break
}else{var id=parentNode.id||parentNode.name;
if(idRegExp.exec(id)){retParentNode=parentNode;
break
}}}parentNode=parentNode.parentNode
}return retParentNode
};
function WGGInputValidator(name,regexp){this.changeListeners=[];
this.input=null;
this.regexp=regexp;
this.oldValue="";
this.eventManagers=[];
if(name){if(typeof name=="string"){var input=document.getElementsByName(name);
if(input==null){return
}if(input.length==null){return
}this.input=input[0]
}else{this.input=name
}if(this.input!=null){var eventMng=new WGGEventsManager(this,this.input);
eventMng.addEventListener("keyup",this,this.__onKeyUp);
this.eventManagers.push(eventMng)
}}}WGGInputValidator.prototype.__onKeyUp=function __keyUp(e){if(this.regexp==""){this.validatorRef.notifyChangeListeners();
return
}var myEvent=document.all?event:e;
var obj=document.all?myEvent.srcElement:myEvent.target;
var tastenCode=document.all?myEvent.keyCode:myEvent.which;
if(tastenCode==0||tastenCode==8||tastenCode==13||tastenCode==44||tastenCode==45||tastenCode==46){this.oldValue=obj.value;
this.notifyChangeListeners();
return
}var result=obj.value.match(this.regexp);
if(!result){obj.value=this.oldValue
}else{if(result[0]!=obj.value){obj.value=this.oldValue
}else{this.oldValue=obj.value
}}this.notifyChangeListeners()
};
WGGInputValidator.prototype.addChangeListener=function(changeListener){if(changeListener==null){return
}if(!changeListener.stateChanged){return
}this.changeListeners.push(changeListener)
};
WGGInputValidator.prototype.removeChangeListener=function(changeListener){if(this.changeListeners==null){return
}for(var i=0;
i<this.changeListeners.length;
i++){if(this.changeListeners[i]==changeListener){var firstPart=this.changeListeners.slice(0,i);
var secondPart=new Array();
if(i<(this.changeListeners.length-1)){secondPart=this.changeListeners.slice(i+1)
}this.changeListeners=firstPart.concat(secondPart)
}}};
WGGInputValidator.prototype.notifyChangeListeners=function(){var changeEvent=new WGGChangeEvent(this);
for(var i=0;
i<this.changeListeners.length;
i++){this.changeListeners[i].stateChanged(changeEvent)
}};
WGGInputValidator.prototype.finalize=function(){this.input=null;
return WGGFinalizer.finalize(this)
};
function WGGMessageBox(type,title,message,messageBoxClassName,functionNames){if(!WGGMessageBox.isTypeValid(type)){return
}this.type=type;
this.title=(title!=null)?title:WGGMessageBox.TITLE;
this.message=(message!=null)?message:WGGMessageBox.MESSAGE;
this.messageBoxClassName=messageBoxClassName;
this.functionNames=functionNames;
this.showMessage=function(){var d=document;
if(d.getElementById("messageBox")){return
}var messageBoxObj=d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
messageBoxObj.id="messageBox";
messageBoxObj.style.height=document.documentElement.scrollHeight+"px";
messageBoxObj.className=this.messageBoxClassName;
var alertObj=messageBoxObj.appendChild(d.createElement("div"));
alertObj.id="alertBox";
var title=alertObj.appendChild(d.createElement("h1"));
title.appendChild(d.createTextNode(this.title));
var msg=alertObj.appendChild(d.createElement("p"));
alert(msg.tagName);
var textNode=d.createTextNode(this.message);
msg.appendChild(textNode);
alert("msg.offsetWidth: "+msg.offsetWidth);
alertObj.style.width=(msg.offsetWidth+100)+"px";
alert("alertObj.style.width: "+alertObj.style.width);
if(d.all&&!window.opera){alertObj.style.top=document.documentElement.scrollTop+"px"
}alertObj.style.left=(d.documentElement.scrollWidth-alertObj.offsetWidth)/2+"px";
alertObj.style.top=(d.documentElement.offsetHeight-alertObj.offsetHeight)/2+"px";
switch(this.type){case WGGMessageBox.TYPE_CONFIRM:var spanObj=alertObj.appendChild(d.createElement("span"));
var btnOk=spanObj.appendChild(d.createElement("a"));
btnOk.id="btnOk";
btnOk.appendChild(d.createTextNode(WGGMessageBox.BTN_OK));
btnOk.href="#";
btnOk.messageBoxRef=this;
btnOk.onclick=function(){document.getElementsByTagName("body")[0].removeChild(document.getElementById("messageBox"));
this.messageBoxRef.callFunction(0);
return false
};
var space="";
for(var i=0;
i<5;
i++){space+=String.fromCharCode(160)
}spanObj.appendChild(d.createTextNode(space));
var btnCancel=spanObj.appendChild(d.createElement("a"));
btnCancel.id="btnCancel";
btnCancel.appendChild(d.createTextNode(WGGMessageBox.BTN_CANCEL));
btnCancel.href="#";
btnCancel.messageBoxRef=this;
btnCancel.onclick=function(){document.getElementsByTagName("body")[0].removeChild(document.getElementById("messageBox"));
this.messageBoxRef.callFunction(1);
return false
};
break;
case WGGMessageBox.TYPE_ALERT:var spanObj=alertObj.appendChild(d.createElement("span"));
var btnOk=spanObj.appendChild(d.createElement("a"));
btnOk.id="btnOk";
btnOk.appendChild(d.createTextNode(WGGMessageBox.BTN_OK));
btnOk.href="#";
btnOk.style.display="block";
btnCancel.messageBoxRef=this;
btnOk.onclick=function(){document.getElementsByTagName("body")[0].removeChild(document.getElementById("messageBox"));
this.messageBoxRef.callFunction(0);
return false
};
break
}};
this.callFunction=function(index){if(this.functionNames!=null){if(DataTypeUtils.isArray(this.functionNames)){if(index<this.functionNames.length){window.setTimeout(this.functionNames[index]+"()",0)
}}}}
}WGGMessageBox.TYPE_CONFIRM=1;
WGGMessageBox.TYPE_ALERT=2;
WGGMessageBox.VALID_TYPES=new Array(WGGMessageBox.TYPE_CONFIRM,WGGMessageBox.TYPE_ALERT);
WGGMessageBox.isTypeValid=function(type){for(var i=0;
i<WGGMessageBox.VALID_TYPES.length;
i++){if(WGGMessageBox.VALID_TYPES[i]==type){return true
}}return false
};
WGGMessageBox.TITLE="MessageBox";
WGGMessageBox.MESSAGE="This is a message!";
WGGMessageBox.BTN_OK="Ok";
WGGMessageBox.BTN_CANCEL="Cancel";
function WGGSimpleGUIStuffFactory(){return JSINER.extend(this,"WGGAbstractGUIStuffFactory")
}WGGSimpleGUIStuffFactory.prototype.createTreeNode=function(parentTree,parentNode,handledObj){return new WGGSimpleTree.TreeNode(parentTree,parentNode,handledObj)
};
WGGSimpleGUIStuffFactory.prototype.createEventsManager=function(){var handlerObject=arguments[0];
var obj=arguments[1];
return new WGGEventsManager(handlerObject,obj,false)
};
WGGSimpleGUIStuffFactory.prototype.createTreeModel=function(){var modelDesc=arguments[0];
var observerObj=arguments[1];
if(WGGDataTypeUtils.isString(modelDesc)){return new WGGSimpleTree.SimpleTreeModel_0(modelDesc,observerObj)
}else{return new WGGSimpleTree.SimpleTreeModel_1(modelDesc,observerObj)
}};
WGGSimpleGUIStuffFactory.prototype.createTree=function(doc,domElement,model){return new WGGSimpleTree(doc,domElement,model)
};
function WGGSimpleTree(doc,domElement,model){this.doc=null;
this.domElement=null;
this.model=null;
this.treeStuffFactory=WGGAbstractGUIStuffFactory.createFactory("simple0");
this._rootElement=null;
this._rootTreeItem=null;
if(model!=null){this.initialize(doc,domElement,model,this.treeStuffFactory)
}}WGGSimpleTree.TreeNode=function(parentTree,parentNode,handledObj,value){this.parentTree=parentTree;
this.parentNode=parentNode;
this.handledObj=handledObj;
this.value=value;
this.evtMng=this.parentTree.treeStuffFactory.createEventsManager(this,this.handledObj);
if(this.evtMng){this.evtMng.setEl(this.handledObj.firstChild)
}this.evtMngLinkAll=null;
this.childNodes=[];
this.evtMng.addEventListenersMap(this,{click:"expand"})
};
WGGSimpleTree.TreeNode.prototype.getChildNodes=function(){return this.childNodes
};
WGGSimpleTree.TreeNode.prototype.hasParentNode=function(){return(this.parentNode!=null)
};
WGGSimpleTree.TreeNode.prototype.appendChild=function(treeNode){this.childNodes[this.childNodes.length]=treeNode
};
WGGSimpleTree.TreeNode.prototype.getLevel=function(){if(this.parentNode==null){return 0
}var treeNode=this.parentNode;
var lvl=0;
while(treeNode!=null){lvl++;
treeNode=treeNode.parentNode
}return lvl
};
WGGSimpleTree.TreeNode.prototype.expand=function(){this.onExpand()
};
WGGSimpleTree.TreeNode.prototype.displayAll=function(){this.onDisplayAll()
};
WGGSimpleTree.TreeNode.prototype.onExpand=function(){if(this.handledObj==null){return
}var link=this.handledObj.firstChild;
if(link==null){return
}var style=link.style;
if(style==null){return
}var processedNodes=[];
var sibling=link.nextSibling;
if(sibling==null){if(!WGGDataTypeUtils.isPrimitive(this.value)){try{for(var name in this.value){var processedNode=this.parentTree.model.processNode(this,this.value,name);
processedNodes.push(processedNode);
var childValue=null;
try{childValue=this.value[name]
}catch(e){childValue="DENIED"
}this.parentTree.model.processNode(processedNode,null,childValue)
}}catch(ex){alert(new WGGField(ex))
}}sibling=link.nextSibling
}if(sibling==null){return
}var currentDisplay=sibling.style.display;
var newDisplay=null;
if(currentDisplay=="none"){link.firstChild.nodeValue=link.firstChild.nodeValue.replace("[+]","[-]");
newDisplay="block";
this.displayAllLink(link,processedNodes)
}else{link.firstChild.nodeValue=link.firstChild.nodeValue.replace("[-]","[+]");
newDisplay="none"
}while(sibling){sibling.style.display=newDisplay;
sibling=sibling.nextSibling
}};
WGGSimpleTree.TreeNode.prototype.onDisplayAll=function(){var bExpanded=false;
for(var i=0;
i<this.childNodes.length;
i++){var childTreeNode=this.childNodes[i];
childTreeNode.expand();
if(i==0){bExpanded=childTreeNode.isExpanded()
}}var link=WGGHtmlUtils.getFirstElementByClassName(this.handledObj,"A","simpleTreeDisplayAllLink");
if(bExpanded){link.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&lt;reduce all&gt;"
}else{link.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&lt;expand all&gt;"
}};
WGGSimpleTree.TreeNode.prototype.isExpanded=function(){if(this.handledObj==null){return false
}var link=this.handledObj.firstChild;
if(link==null){return false
}var style=link.style;
if(style==null){return false
}var sibling=link.nextSibling;
if(sibling==null){return true
}return(sibling.style.display!="none")
};
WGGSimpleTree.TreeNode.prototype.displayAllLink=function(ancestor,processedNodes){var link=WGGHtmlUtils.getFirstElementByClassName(this.handledObj,"A","simpleTreeDisplayAllLink");
if(link!=null){link.style.display=(link.style.display=="inline")?"none":"inline"
}else{var link=this.parentTree.doc.createElement("a");
link.className="simpleTreeDisplayAllLink";
link.style.display="inline";
link.style.color="darkgreen";
link.style.fontWeight="bold";
link.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&lt;expand all&gt;";
ancestor.parentNode.insertBefore(link,ancestor.nextSibling);
this.evtMngLinkAll=this.parentTree.treeStuffFactory.createEventsManager(this,link);
this.evtMngLinkAll.addEventListenersMap(this,{click:"displayAll"})
}};
WGGSimpleTree.prototype.nodeFound=function(parent,modelNode,bLeaf,bAlreadyFound){var div=this.doc.createElement("div");
div.className="simpleTreeDiv";
if(parent==null){div.style.display="block"
}else{div.style.display="none"
}var link=this.doc.createElement("a");
link.style.display="block";
var prefix=(bLeaf)?"&nbsp;&nbsp;&nbsp;":"[+]";
var shownValue=this.model.serialize(modelNode);
link.appendChild(this.doc.createTextNode(shownValue));
link.innerHTML=prefix+" "+link.innerHTML;
div.appendChild(link);
var treeNode=null;
if(this._rootElement==null&&this._rootTreeItem==null){this._rootElement=div;
treeNode=new WGGSimpleTree.TreeNode(this,null,this._rootElement,modelNode);
this.domElement.appendChild(this._rootElement);
this._rootTreeItem=treeNode
}else{var parentTreeItem=parent;
var parentElement=parent.handledObj;
treeNode=new WGGSimpleTree.TreeNode(this,parentTreeItem,div,modelNode);
parentElement.appendChild(div);
parentTreeItem.appendChild(treeNode)
}return treeNode
};
WGGSimpleTree.SimpleTreeModel_1=function(modelDescription,observerObject){this.obj=modelDescription;
this.observerObject=null;
if(observerObject!=null){if(WGGDataTypeUtils.isFunction(observerObject.nodeFound)){this.observerObject=observerObject
}}else{this.observerObject={nodeFound:function(){alert("node "+arguments[1]+" found on lvl "+arguments[0])
}}
}this.getRoot=function(){return this.obj
};
this.serialize=function(node){if(node==null){return null
}if(WGGDataTypeUtils.isPrimitive(node)){return node
}var value="";
if(WGGDataTypeUtils.isFunction(node)){var method=new WGGMethod(node);
value=method.getValue()+" ("+method.getType()+")"
}else{var field=new WGGField(node);
if(WGGDataTypeUtils.isPrimitive(node)){value=field.getValue()
}value+=" ("+field.getType()+")"
}return value
};
this.process=function(){this.processNode(null,null,this.getRoot())
};
this.cache=new WGGArray();
this.processNode=function(parent,modelNodeContext,modelNode){if(modelNode==null){return null
}var bPrimitive=WGGDataTypeUtils.isPrimitive(modelNode);
if(bPrimitive&&modelNodeContext!=null){try{bPrimitive=(modelNodeContext[modelNode]==null)
}catch(e){bPrimitive=true
}}var bAlreadyFound=false;
try{}catch(e){bAlreadyFound=false
}if(!bPrimitive){try{}catch(e){alert("modelNode cannot be accessed: "+e.message)
}}return this.observerObject.nodeFound(parent,modelNode,bPrimitive,bAlreadyFound)
}
};
WGGSimpleTree.prototype.initialize=function(doc,domElement,model,treeStuffFactory){if(doc==null){doc=document
}if(domElement==null){return
}if(model==null){return
}if(treeStuffFactory==null){return
}this.doc=doc;
this.domElement=domElement;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){this.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){this.debugInterface=new WGGNullDebugInterface()
}if(model){this.model=treeStuffFactory.createTreeModel(model,this);
this.model.process()
}};
WGGSimpleTree.prototype.dummy=function(){};
function WGGSpinner(name,spinnerModel,parent,cssClass,imgPreviousSrcArray,imgNextSrcArray,changeable,align,width,position,label){var self=JSINER.extend(this,"WGGChangeListener");
if(name==null){return
}self.spinnerModel=spinnerModel;
self.spinnerModel.addChangeListener(self);
self.textField=null;
self.changeable=changeable;
self.align=align;
self.width=width;
self.position=position;
self.label=label;
self.imgPreviousSrcArray=imgPreviousSrcArray;
self.imgNextSrcArray=imgNextSrcArray;
self.editor=WGGSpinner.EditorFactory.createEditor(self.spinnerModel);
var divObj=thisDoc.createElement("div");
if(self.align!=null){if(self.align=="center"||self.align=="left"||self.align=="right"){if(WGGBrowserDetector.IS_IE){divObj.style.styleFloat=self.align
}else{divObj.style.cssFloat=self.align
}}}divObj.style.display="inline";
divObj.style.margin="0px";
divObj.className=cssClass;
parent.appendChild(divObj);
var tableObj=thisDoc.createElement("table");
tableObj.style.display="inline";
tableObj.style.margin="0px";
divObj.appendChild(tableObj);
var tbodyObj=thisDoc.createElement("tbody");
tableObj.appendChild(tbodyObj);
var trObj1=thisDoc.createElement("tr");
tbodyObj.appendChild(trObj1);
var tdObj1_0=thisDoc.createElement("td");
tdObj1_0.style.verticalAlign="middle";
tdObj1_0.style.padding="0px";
trObj1.appendChild(tdObj1_0);
var inputObj=null;
if(isIE){inputObj=thisDoc.createElement('<input type="text" name="'+name+'" value="'+self.spinnerModel.getValue()+'">')
}else{inputObj=thisDoc.createElement("input")
}if(self.width>0){inputObj.style.width=self.width+"px";
var nextImage=new Image();
nextImage.alreadyLoaded=false;
nextImage.src=self.imgNextSrcArray[0];
var previousImage=new Image();
previousImage.alreadyLoaded=false;
previousImage.src=self.imgPreviousSrcArray[0];
if(self.position==WGGSpinner.POSITION_BUTTON_VERTICAL){if(nextImage.complete){if(!nextImage.alreadyLoaded){var newInputWidth=(parseInt(inputObj.style.width)-nextImage.width);
if(newInputWidth>0){inputObj.style.width=newInputWidth+"px"
}nextImage.alreadyLoaded=true
}}else{nextImage.onload=function(){var newInputWidth=(parseInt(inputObj.style.width)-self.width);
if(newInputWidth>0){inputObj.style.width=newInputWidth+"px"
}this.alreadyLoaded=true
}
}}else{if(nextImage.complete){if(!nextImage.alreadyLoaded){var newInputWidth=(parseInt(inputObj.style.width)-2*nextImage.width);
if(newInputWidth>0){inputObj.style.width=newInputWidth+"px"
}nextImage.alreadyLoaded=true
}}else{nextImage.onload=function(){var newInputWidth=(parseInt(inputObj.style.width)-2*this.width);
if(newInputWidth>0){inputObj.style.width=newInputWidth+"px"
}this.alreadyLoaded=true
}
}}}inputObj.name=name;
inputObj.type="text";
inputObj.spinnerRef=self;
inputObj.value=self.spinnerModel.getValue();
inputObj.oldValue=inputObj.value;
tdObj1_0.appendChild(inputObj);
if(self.changeable==true){inputObj.onfocus=function(){self.oldValue=this.value
};
inputObj.onchange=function(){var newValue=this.spinnerRef.editor.validate(this.spinnerRef,this.value);
if(newValue!=null){this.value=newValue;
this.spinnerRef.spinnerModel.setValue(newValue)
}else{this.value=self.oldValue
}}
}else{inputObj.disabled=true
}self.textField=inputObj;
var tdObj1_1=thisDoc.createElement("td");
tdObj1_1.style.verticalAlign="middle";
tdObj1_1.style.textAlign="left";
tdObj1_1.style.padding="0px";
trObj1.appendChild(tdObj1_1);
var imgObjNext=thisDoc.createElement("img");
imgObjNext.src=self.imgNextSrcArray[0];
imgObjNext.spinnerRef=self;
imgObjNext.onmousedown=function(){this.src=this.spinnerRef.imgNextSrcArray[1];
if(!this.spinnerRef.changeable){return true
}var keyIterator=this.spinnerRef.spinnerModel.getKeyIterator();
if(keyIterator.hasNext()){var key=keyIterator.next();
this.spinnerRef.textField.value=this.spinnerRef.spinnerModel.getValue();
this.spinnerRef.spinnerModel.notifyChangeListeners()
}};
imgObjNext.onmouseup=function(){this.src=this.spinnerRef.imgNextSrcArray[0]
};
tdObj1_1.appendChild(imgObjNext);
if(self.position==WGGSpinner.POSITION_BUTTON_VERTICAL){var brObj=thisDoc.createElement("br");
tdObj1_1.appendChild(brObj)
}var imgObjPrevious=thisDoc.createElement("img");
imgObjPrevious.src=imgPreviousSrcArray[0];
imgObjPrevious.spinnerRef=self;
imgObjPrevious.onmousedown=function(){this.src=this.spinnerRef.imgPreviousSrcArray[1];
if(!this.spinnerRef.changeable){return true
}var keyIterator=this.spinnerRef.spinnerModel.getKeyIterator();
if(keyIterator.hasPrevious()){keyIterator.previous();
this.spinnerRef.textField.value=this.spinnerRef.spinnerModel.getValue();
this.spinnerRef.spinnerModel.notifyChangeListeners()
}};
imgObjPrevious.onmouseup=function(){this.src=this.spinnerRef.imgPreviousSrcArray[0]
};
tdObj1_1.appendChild(imgObjPrevious);
if(self.label){var tdObj1_2=thisDoc.createElement("td");
tdObj1_2.style.verticalAlign="middle";
tdObj1_2.style.textAlign="left";
tdObj1_2.style.padding="0px";
trObj1.appendChild(tdObj1_2);
tdObj1_2.appendChild(document.createTextNode(self.label))
}return self
}WGGSpinner.prototype.stateChanged=function(changeEvent){var changedObject=changeEvent.getSource();
this.textField.value=changedObject.getValue()
};
WGGSpinner.prototype.getModel=function(){return this.spinnerModel
};
WGGSpinner.prototype.setDefaultItem=function(key){var test="";
var keyIterator=this.spinnerModel.getKeyIterator();
var found=false;
while(keyIterator.hasNext()){var currentKey=keyIterator.next();
test+=currentKey+" != "+key+";";
if(currentKey==key){this.textField.value=this.spinnerModel.getValue();
found=true;
break
}}if(!found){keyIterator.reset();
var currentKey=keyIterator.next();
this.textField.value=this.spinnerModel.getValue()
}};
WGGSpinner.prototype.chooseAndShowValue=function(value){var keyIterator=this.spinnerModel.getKeyIterator();
keyIterator.reset();
var found=false;
while(keyIterator.hasNext()){var currentKey=keyIterator.next();
if(this.spinnerModel.getValue()==value){this.textField.value=this.spinnerModel.getValue();
found=true;
break
}}};
WGGSpinner.prototype.setChangeable=function(changeable){this.changeable=changeable;
if(this.changeable){this.textField.disabled=false
}};
WGGSpinner.prototype.isChangeable=function(){return this.changeable
};
WGGSpinner.POSITION_BUTTON_VERTICAL=1;
WGGSpinner.POSITION_BUTTON_HORIZONTAL=2;
WGGSpinner.DefaultEditor=function(){this.validate=function(spinnerRef,value){return value
}
};
WGGSpinner.NumberEditor=function(){this.validate=function(spinnerRef,value){var valueAsNumber=Number(value);
if(isNaN(valueAsNumber)){return null
}if(valueAsNumber>=spinnerRef.spinnerModel.keyIterator.minimum&&valueAsNumber<=spinnerRef.spinnerModel.keyIterator.maximum){return valueAsNumber
}return null
}
};
WGGSpinner.ListEditor=function(){this.validate=function(spinnerRef,value){var tmpValue=String(value);
if(spinnerRef.spinnerModel.hashMap.containsValue(tmpValue)){return tmpValue
}return null
}
};
WGGSpinner.EditorFactory=function(){};
WGGSpinner.EditorFactory.createEditor=function(spinnerModel){if(spinnerModel==null){return new WGGSpinner.DefaultEditor()
}if(WGGDataTypeUtils.instanceOf(spinnerModel,WGGSpinnerDefaultModel)){return new WGGSpinner.DefaultEditor()
}else{if(WGGDataTypeUtils.instanceOf(spinnerModel,WGGSpinnerListModel)||WGGDataTypeUtils.instanceOf(spinnerModel,WGGSpinnerMixedModel)){return new WGGSpinner.ListEditor()
}else{if(WGGDataTypeUtils.instanceOf(spinnerModel,WGGSpinnerNumberModel)){return new WGGSpinner.NumberEditor()
}}}return new WGGSpinner.DefaultEditor()
};
function WGGSpinnerDefaultModel(hashMap,editable){this.changeListeners=null;
this.hashMap=hashMap;
this.keyIterator=null;
this.editable=editable
}WGGSpinnerDefaultModel.prototype.initialize=function(){this.changeListeners=new Array();
if(this.hashMap!=null){this.keyIterator=this.hashMap.keyIterator();
this.keyIterator.next()
}};
WGGSpinnerDefaultModel.prototype.getKeyIterator=function(){return this.keyIterator
};
WGGSpinnerDefaultModel.prototype.addChangeListener=function(changeListener){if(changeListener==null){return
}if(!changeListener.stateChanged){return
}this.changeListeners.push(changeListener)
};
WGGSpinnerDefaultModel.prototype.getNextValue=function(){if(this.keyIterator.hasNext()){var next=this.keyIterator.next();
this.keyIterator.previous();
return this.hashMap.get(next)
}return null
};
WGGSpinnerDefaultModel.prototype.getPreviousValue=function(){if(this.keyIterator.hasPrevious()){var previous=this.keyIterator.previous();
this.keyIterator.next();
return this.hashMap.get(previous)
}return null
};
WGGSpinnerDefaultModel.prototype.getValue=function(){var current=this.keyIterator.current();
if(current==null){return null
}return this.hashMap.get(current)
};
WGGSpinnerDefaultModel.prototype.removeChangeListener=function(changeListener){if(this.changeListeners==null){return
}for(var i=0;
i<this.changeListeners.length;
i++){if(this.changeListeners[i]==changeListener){var firstPart=this.changeListeners.slice(0,i);
var secondPart=new Array();
if(i<(this.changeListeners.length-1)){secondPart=this.changeListeners.slice(i+1)
}this.changeListeners=firstPart.concat(secondPart)
}}};
WGGSpinnerDefaultModel.prototype.notifyChangeListeners=function(){var changeEvent=new WGGChangeEvent(this);
for(var i=0;
i<this.changeListeners.length;
i++){this.changeListeners[i].stateChanged(changeEvent)
}};
WGGSpinnerDefaultModel.prototype.setValue=function(value){if(this.editable==false){entryIterator=this.hashMap.entryIterator();
var i=0;
var valueFound=true;
while(entryIterator.hasNext()){var entry=entryIterator.next();
if(entry==value){valueFound=true;
break
}i++
}if(valueFound){keyIterator=this.keyIterator;
keyIterator.reset();
var j=0;
var current=null;
while(keyIterator.hasNext()){current=keyIterator.next();
if(j==i){break
}j++
}this.hashMap.put(current,value)
}}else{var current=this.keyIterator.current();
if(current==null){return null
}this.hashMap.put(current,value)
}this.notifyChangeListeners()
};
function WGGSpinnerListModel(hashMap){var self=JSINER.extend(this,"WGGSpinnerDefaultModel");
if(hashMap==null){return
}self.hashMap=hashMap;
self.initialize();
return self
};
function WGGSpinnerMixedModel(minimum,maximum,stepSize,hashMap,editable){var self=JSINER.extend(this,"WGGSpinnerDefaultModel");
if(minimum==null){return
}self.spinnerListModel=new WGGSpinnerListModel(hashMap);
self.spinnerNumberModel=new WGGSpinnerNumberModel(minimum,maximum,stepSize);
self.initialize(editable);
return self
}WGGSpinnerMixedModel.prototype.initialize=function(editable){this.changeListeners=new Array();
var models=new Array(this.spinnerListModel,this.spinnerNumberModel);
var hashMap=new WGGHashMap();
for(var i=0;
i<models.length;
i++){var model=models[i];
var iterator=model.getKeyIterator();
iterator.reset();
while(iterator.hasNext()){var key=iterator.next();
if(WGGDataTypeUtils.isNumber(key)){key=key.toString()
}hashMap.put(key,model.getValue())
}}this.hashMap=hashMap;
this.keyIterator=hashMap.keyIterator();
this.editable=editable
};
function WGGSpinnerNumberModel(minimum,maximum,stepSize){var self=JSINER.extend(this,"WGGSpinnerDefaultModel");
if(minimum==null){return
}self.keyIterator=new WGGNumberRangeIterator(minimum,maximum,stepSize);
self.initialize();
return self
}WGGSpinnerNumberModel.prototype.initialize=function(){this.changeListeners=new Array()
};
WGGSpinnerNumberModel.prototype.getNextValue=function(){if(this.keyIterator.hasNext()){var next=this.keyIterator.next();
this.keyIterator.previous();
return next
}return null
};
WGGSpinnerNumberModel.prototype.getPreviousValue=function(){if(this.keyIterator.hasPrevious()){var previous=this.keyIterator.previous();
this.keyIterator.next();
return previous
}return null
};
WGGSpinnerNumberModel.prototype.getValue=function(){return this.keyIterator.current()
};
WGGSpinnerNumberModel.prototype.setValue=function(value){this.keyIterator.setValue(value);
this.notifyChangeListeners()
};
function WGGTimeInputValidator(name,format,displayValue,invalidValueInserted){this.format=format;
this.displayValue=displayValue;
this.onInsertInvalidValue=null;
if(invalidValueInserted!=null){if(!WGGDataTypeUtils.isFunction(invalidValueInserted)){throw"invalidValueInserted should be a Function"
}this.onInsertInvalidValue=invalidValueInserted
}this.caretDetector=new WGGCaretDetector(name);
this.initialize(name)
}WGGTimeInputValidator.prototype.getTimeParts=function(userInput){for(var i=0;
i<WGGTimeInputValidator.sepPlaceholders.length;
i++){var sepPlaceholder=WGGTimeInputValidator.sepPlaceholders[i];
var parts=userInput.split(sepPlaceholder);
if(parts.length>1){return parts
}}return[userInput]
};
WGGTimeInputValidator.prototype.isUserInputValid=function(userInput){var dateParts=this.getTimeParts(userInput);
return(dateParts.length==3)
};
WGGTimeInputValidator.prototype.fireInvalidValueInserted=function(){var args=[];
for(var i=0;
i<arguments.length;
i++){args[i]=arguments[i]
}if(this.onInsertInvalidValue!=null){this.onInsertInvalidValue.apply(this,args)
}};
WGGTimeInputValidator.prototype.completeUserInput=function(userInput){if(userInput==null){return null
}if(userInput.length==this.format.length){return userInput
}WGGAbstractDebugInterface.gDebugInterface.debug("///////////////////////////////////////////////////////////////");
WGGAbstractDebugInterface.gDebugInterface.debug("format:"+this.format);
WGGAbstractDebugInterface.gDebugInterface.debug("userInput:"+userInput);
WGGAbstractDebugInterface.gDebugInterface.debug("appended:"+userInput+this.format.substring(userInput.length));
WGGAbstractDebugInterface.gDebugInterface.debug("///////////////////////////////////////////////////////////////");
return userInput+this.format.substring(userInput.length)
};
WGGTimeInputValidator.prototype.initialize=function(name){if(!name){return
}var input=document.getElementsByName(name);
if(input==null||input.length==0){input=document.getElementById(name)
}if(input==null||input.length==0){return
}if(input.length>0){input=input[0]
}input.__inputValidatorRef=this;
if(input!=null){var isValid=false;
for(var i=0;
i<WGGTimeInputValidator.validFormats.length;
i++){if(WGGTimeInputValidator.validFormats[i]==this.format){isValid=true;
break
}}if(!isValid){format=WGGTimeInputValidator.validFormats[0]
}if(this.displayValue==null||this.displayValue==""){input.onfocus=function(e){if(this.value==""){this.value=this.__inputValidatorRef.format
}this.__inputValidatorRef.caretDetector.doSetCaretPosition(0)
};
input.onblur=function(e){if(this.value==this.__inputValidatorRef.format){this.value=""
}else{if(this.value==""){}else{var timeParts=this.__inputValidatorRef.getTimeParts(this.value);
if(!this.__inputValidatorRef.isUserInputValid(this.value)){this.__inputValidatorRef.fireInvalidValueInserted(this.value,{hours:null,minutes:null});
return
}var hours=Number(timeParts[0]);
var minutes=Number(timeParts[1]);
if(hours<0||hours>23){this.__inputValidatorRef.fireInvalidValueInserted(this.value,{hours:hours,minutes:minutes});
return
}if(minutes<0||minutes>59){this.__inputValidatorRef.fireInvalidValueInserted(this.value,{hours:hours,minutes:minutes});
return
}}}}
}input.onkeyup=function(e){};
input.onkeydown=function(e){var myEvent=window.event||e;
var usrKeyCode=myEvent.keyCode||myEvent.which;
return(!(usrKeyCode==46&&WGGBrowserDetector.IS_IE))
};
input.onkeypress=function(e){WGGAbstractDebugInterface.gDebugInterface.debug("~~~~~~~~~~~ onKeyPress");
var myEvent=window.event||e;
var obj=myEvent.srcElement||myEvent.target;
var usrKeyCode=myEvent.keyCode||myEvent.which;
var usrCharCode=WGGBrowserDetector.IS_IE?myEvent.keyCode:myEvent.charCode;
var usrChar=WGGStringUtils.chr(usrCharCode);
WGGAbstractDebugInterface.gDebugInterface.debug("usrKeyCode => usrCharCode => usrChar : "+usrKeyCode+"=>"+usrCharCode+"=>"+usrChar);
if(this.value.length>this.__inputValidatorRef.format.length){return false
}if(usrKeyCode==8||usrKeyCode==36||usrKeyCode==39||usrKeyCode==37){return true
}else{if(WGGTimeInputValidator.isSepPlaceholderValid(usrChar)){if(this.__inputValidatorRef.format.indexOf(usrChar)!=-1){var caretPos=this.__inputValidatorRef.caretDetector.doGetCaretPosition();
if(this.__inputValidatorRef.format.charAt(caretPos)==usrChar){if(this.value.charAt(caretPos)==usrChar){this.__inputValidatorRef.caretDetector.doSetCaretPosition(caretPos+1);
return false
}}}}else{if(!(usrKeyCode>47&&usrKeyCode<58)){return false
}}}var caretPos=this.__inputValidatorRef.caretDetector.doGetCaretPosition();
var nextChar=this.__inputValidatorRef.format.charAt(caretPos);
if(WGGTimeInputValidator.isSepPlaceholderValid(nextChar)){var tmp=this.value.substring(0,caretPos+1);
if((caretPos+2)<this.value.length){tmp+=this.value.substring(caretPos+2)
}else{if(!WGGTimeInputValidator.isSepPlaceholderValid(usrChar)){tmp+=nextChar
}}this.value=tmp;
this.__inputValidatorRef.caretDetector.doSetCaretPosition(caretPos+1)
}else{if(WGGTimeInputValidator.isSepPlaceholderValid(usrChar)){return false
}var tmp=this.value.substring(0,caretPos);
if((caretPos+1)<this.value.length){tmp+=this.value.substring(caretPos+1)
}this.value=tmp;
this.__inputValidatorRef.caretDetector.doSetCaretPosition(caretPos)
}if(this.value.length>=this.__inputValidatorRef.format.length){return false
}return true
}
}};
WGGTimeInputValidator.isSepPlaceholderValid=function(sepPlaceholder){if(sepPlaceholder==null){return false
}for(var i=0;
i<WGGTimeInputValidator.sepPlaceholders.length;
i++){if(WGGTimeInputValidator.sepPlaceholders[i]==sepPlaceholder){return true
}}return false
};
WGGTimeInputValidator.numPlaceholder="_";
WGGTimeInputValidator.sepPlaceholders=[":"];
WGGTimeInputValidator.validFormats=["__:__"];
function WGGWaitMessageBox(message,messageBoxClassName,image,doc){this.message=(message!=null)?message:WGGWaitMessageBox.MESSAGE;
this.messageBoxClassName=messageBoxClassName;
this.iframes=[];
this.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){this.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){this.debugInterface=new WGGNullDebugInterface()
}this.doc=doc||document;
this.showMessage=function(){if(this.doc.getElementById("waitMessageBox")){return
}var body=this.doc.getElementsByTagName("body")[0];
var outerBox=body.appendChild(this.doc.createElement("DIV"));
outerBox.id="waitMessageBox";
outerBox.style.position="absolute";
outerBox.style.overflow="hidden";
var middleBox=outerBox.appendChild(this.doc.createElement("DIV"));
middleBox.id="waitMessageBox2";
middleBox.style.position="absolute";
middleBox.style.top="50%";
middleBox.style.verticalAlign="middle";
middleBox.style.textAlign="center";
middleBox.style.width="100%";
var innerBox=middleBox.appendChild(this.doc.createElement("DIV"));
innerBox.id="waitMessageBox3";
innerBox.style.position="relative";
innerBox.style.top="-50%";
innerBox.style.textAlign="center";
innerBox.style.marginLeft="auto";
innerBox.style.marginRight="auto";
innerBox.style.width="200px";
var textNode=this.doc.createTextNode(this.message);
innerBox.appendChild(textNode);
if(image!=null){var brNode=this.doc.createElement("BR");
innerBox.appendChild(brNode);
innerBox.appendChild(image)
}if(this.messageBoxClassName==null){outerBox.style.MozOpacity="0.3";
outerBox.style.filter="alpha(opacity=30)";
innerBox.style.fontSize="100px"
}else{outerBox.className=this.messageBoxClassName
}body.style.overflow="hidden";
if(WGGBrowserDetector.IS_IE&&WGGBrowserDetector.version=="6.0"){var selectBoxes=document.getElementsByTagName("SELECT");
if(selectBoxes.length!=0){for(var i=0;
i<selectBoxes.length;
i++){var selectBox=selectBoxes[i];
var hidingIframe=this.doc.createElement("IFRAME");
this.iframes.push(hidingIframe);
hidingIframe.className="waitMessageBoxIframe";
hidingIframe.style.position="absolute";
hidingIframe.style.width=selectBox.offsetWidth;
hidingIframe.style.height=selectBox.offsetHeight;
var selectBoxPosition=WGGGUIUtils.getPosition(selectBox);
hidingIframe.style.top=selectBoxPosition.top+"px";
hidingIframe.style.left=selectBoxPosition.left+"px";
hidingIframe.src="javascript:'';";
hidingIframe.scrolling="no";
hidingIframe.frameBorder=0;
hidingIframe.style.border="none";
hidingIframe.style.display="block";
hidingIframe.style.zIndex=(selectBox.zIndex!=-1)?selectBox.zIndex+1:1;
hidingIframe.style.filter="alpha(opacity=0)";
this.doc.body.appendChild(hidingIframe)
}}}var clientWidth=WGGGUIUtils.getClientWidth();
var clientHeight=WGGGUIUtils.getClientHeight();
var scrollLeft=WGGGUIUtils.getScrollLeft();
var scrollTop=WGGGUIUtils.getScrollTop();
outerBox.style.top=scrollTop+"px";
outerBox.style.left=scrollLeft+"px";
outerBox.style.height=clientHeight+"px";
outerBox.style.width=clientWidth+"px"
};
this.hideMessage=function(){var outerBox=this.doc.getElementById("waitMessageBox");
if(outerBox==null){return
}outerBox.parentNode.removeChild(outerBox);
if(WGGBrowserDetector.IS_IE){var body=this.doc.getElementsByTagName("body")[0];
body.style.overflow="auto";
if(WGGBrowserDetector.version=="6.0"){var i=this.iframes.length-1;
while(this.iframes.length>0){this.iframes[i].parentNode.removeChild(this.iframes[i]);
this.iframes.pop();
i--
}}}}
}WGGWaitMessageBox.MESSAGE="Please wait";
function WGGField(field){var self=JSINER.extend(this,"WGGMember");
if(field!=null){if(WGGDataTypeUtils.isFunction(field)){throw new Error("Parameter '"+field+"' is not a field but function, use WGGMethod class to reflect it")
}}self.field=field;
return self
}WGGField.prototype.getType=function(){return WGGField.getType(this.field)
};
WGGField.prototype.getName=function(){return null
};
WGGField.prototype.getUndecoratedValue=function(){if(!WGGDataTypeUtils.isObject(this.field)){return this.field
}var value="";
try{var i=0;
for(var theMember in this.field){try{if(i>0){value+=","
}value+=theMember+'="'+this.field[theMember]+'"';
i++
}catch(e){value+="[error while fetching information about "+theMember+":"+e.message+"]"
}}}catch(e){var errDesc="";
try{errDesc=WGGDataTypeUtils.isString(e)?e:e.message
}catch(ex){}return"exception ("+errDesc+") thrown during fetching information about value: "+value
}return value
};
WGGField.prototype.getDecoratedValue=function(){return this.getValue()
};
WGGField.prototype.getValue=function(){if(!WGGDataTypeUtils.isObject(this.field)){return this.field
}var value="";
try{var i=0;
for(var theMember in this.field){try{if(i>0){value+=","
}value+=WGGStringUtils.LINE_SEP;
value+="---["+theMember+"="+this.field[theMember]+"]";
i++
}catch(e){value+="---[error while fetching information about "+theMember+":"+e.message+"]"
}}}catch(e){var errDesc="";
try{errDesc=WGGDataTypeUtils.isString(e)?e:e.message
}catch(ex){}return"exception ("+errDesc+") thrown during fetching information about value: "+value
}return value
};
WGGField.prototype.finalize=function(){this.field=null;
return 1
};
WGGField.prototype.toString=function(){return"type="+this.getType()+";"+WGGStringUtils.LINE_SEP+"value="+this.getValue()
};
WGGField.getType=function(field){var cName=null;
try{var c=field.constructor;
var cName=new String(c);
var cNameElements=cName.split(/ /g);
if(cNameElements!=null){if(cNameElements.length>1){var end=cNameElements[1].indexOf("(");
if(end!=-1){cName=cNameElements[1].substring(0,end)
}}}}catch(e){cName="UNKNOWN ("+e.message+")"
}return cName
};
function WGGMember(obj){}WGGMember.prototype.getType=function(){};
WGGMember.prototype.getValue=function(){};
WGGMember.prototype.getName=function(){};
WGGMember.prototype.toString=function(){};
function WGGMethod(method){var self=JSINER.extend(this,"WGGMember");
if(method!=null){if(!WGGDataTypeUtils.isFunction(method)){throw new Error("Parameter '"+method+"' is not a function/method; use WGGField class to reflect it")
}}self.method=method;
return self
}WGGMethod.prototype.getName=function(){if(this.method==null){return""
}var mName=new String(this.method);
var bodyPos=mName.indexOf("{");
if(bodyPos==-1){return""
}mName=mName.substring(0,bodyPos);
var MethodRegExp=function(){return new RegExp("(function)( [a-zA-Z0-9_]+)?(.*)","g")
};
var matches=new MethodRegExp().exec(mName);
if(!matches){return""
}if(matches.length<3){return""
}if(typeof matches[2]=="undefined"){return""
}return WGGStringUtils.trim(matches[2])
};
WGGMethod.prototype.getType=function(){return"Function"
};
WGGMethod.prototype.getValue=function(){return this.method
};
WGGMethod.prototype.finalize=function(){this.method=null;
return 1
};
WGGMethod.prototype.toString=function(){var methodName=this.getName();
return"methodName="+methodName+";methodBody="+this.method
};
function WGGReflection(){}WGGReflection.isMethod=function(obj){return WGGDataTypeUtils.isFunction(obj)
};
WGGReflection.isField=function(obj){return !WGGDataTypeUtils.isFunction(obj)
};
WGGReflection.createMember=function(obj){if(WGGReflection.isMethod(obj)){return new WGGMethod(obj)
}return new WGGField(obj)
};
function WGGAbstractDebugInterface(verbose){this.changeListeners=new Array()
}WGGAbstractDebugInterface.prototype.createMessage=function(caller,obj){return null
};
WGGAbstractDebugInterface.prototype.info=function(obj){};
WGGAbstractDebugInterface.prototype.debug=function(obj){};
WGGAbstractDebugInterface.prototype.error=function(obj){};
WGGAbstractDebugInterface.prototype.warn=function(obj){};
WGGAbstractDebugInterface.prototype.addChangeListener=function(changeListener){if(changeListener==null){return
}try{if(!changeListener.stateChanged){throw"implementation error: listener does not implement stateChanged method"
}}catch(e){throw e
}this.changeListeners.push(changeListener)
};
WGGAbstractDebugInterface.prototype.removeChangeListener=function(changeListener){if(this.changeListeners==null){return
}for(var i=0;
i<this.changeListeners.length;
i++){if(this.changeListeners[i]==changeListener){var firstPart=this.changeListeners.slice(0,i);
var secondPart=new Array();
if(i<(this.changeListeners.length-1)){secondPart=this.changeListeners.slice(i+1)
}this.changeListeners=firstPart.concat(secondPart)
}}};
WGGAbstractDebugInterface.prototype.notifyChangeListeners=function(message){var changeEvent=new WGGChangeEvent(message);
for(var i=0;
i<this.changeListeners.length;
i++){this.changeListeners[i].stateChanged(changeEvent)
}};
WGGAbstractDebugInterface.prototype.finalize=function(){if(this.changeListeners==null){return 0
}var finalizedCount=0;
while(this.changeListeners.length>0){var cl=this.changeListeners.pop();
cl=null;
finalizedCount++
}return finalizedCount
};
WGGAbstractDebugInterface.gDebugInterface=null;
WGGAbstractDebugInterface.MESSAGE_TYPE_INFO="INFO";
WGGAbstractDebugInterface.MESSAGE_TYPE_DEBUG="DEBUG";
WGGAbstractDebugInterface.MESSAGE_TYPE_WARN="WARN";
WGGAbstractDebugInterface.MESSAGE_TYPE_ERROR="ERROR";
WGGAbstractDebugInterface.MESSAGE_TYPES=[WGGAbstractDebugInterface.MESSAGE_TYPE_INFO,WGGAbstractDebugInterface.MESSAGE_TYPE_DEBUG,WGGAbstractDebugInterface.MESSAGE_TYPE_WARN,WGGAbstractDebugInterface.MESSAGE_TYPE_ERROR];
WGGAbstractDebugInterface.LVL_ERROR=1;
WGGAbstractDebugInterface.LVL_WARN=2;
WGGAbstractDebugInterface.LVL_INFO=3;
WGGAbstractDebugInterface.LVL_DEBUG=4;
function WGGNullDebugInterface(verbose){var self=JSINER.extend(this,"WGGAbstractDebugInterface");
return self
};
function WGGObjectDebugInterface(verbose){var self=JSINER.extend(this,"WGGAbstractDebugInterface");
self.verbose=verbose;
self.lineSep=String.fromCharCode(13)+String.fromCharCode(10);
self.changeListeners=[];
self.lvl=(arguments.length>1)?arguments[1]:WGGAbstractDebugInterface.LVL_INFO;
return self
}WGGObjectDebugInterface.prototype.createMessage=function(caller,obj){try{if(typeof console.log!="undefined"){return obj
}}catch(e){}var retVal={object:obj};
if(this.verbose){var callerStr="caller: [[["+new WGGMethod(caller).toString()+"]]]"+this.lineSep;
retVal.caller=callerStr
}return retVal
};
WGGObjectDebugInterface.prototype.redirectToConsole=function(obj){if(obj==null){return false
}try{if(typeof console.log!="undefined"){var type=obj.type;
switch(type){case WGGAbstractDebugInterface.MESSAGE_TYPE_INFO:console.info(obj.text);
break;
case WGGAbstractDebugInterface.MESSAGE_TYPE_DEBUG:if(WGGBrowserDetector.IS_IE){console.log(obj.text)
}else{console.debug(obj.text)
}break;
case WGGAbstractDebugInterface.MESSAGE_TYPE_WARN:console.warn(obj.text);
break;
case WGGAbstractDebugInterface.MESSAGE_TYPE_ERROR:console.error(obj.text);
break
}return true
}}catch(e){return false
}return false
};
WGGObjectDebugInterface.prototype.info=function(obj){if(this.lvl<WGGAbstractDebugInterface.LVL_INFO){return
}var message=this.createMessage(this.info.caller,obj);
var completeMessage={type:WGGAbstractDebugInterface.MESSAGE_TYPE_INFO,text:message};
if(!this.redirectToConsole(completeMessage)){this.notifyChangeListeners(completeMessage)
}};
WGGObjectDebugInterface.prototype.debug=function(obj){if(this.lvl<WGGAbstractDebugInterface.LVL_DEBUG){return
}var message=this.createMessage(this.debug.caller,obj);
var completeMessage={type:WGGAbstractDebugInterface.MESSAGE_TYPE_DEBUG,text:message};
if(!this.redirectToConsole(completeMessage)){this.notifyChangeListeners(completeMessage)
}};
WGGObjectDebugInterface.prototype.error=function(obj){if(this.lvl<WGGAbstractDebugInterface.LVL_ERROR){return
}var message=this.createMessage(this.error.caller,obj);
var completeMessage={type:WGGAbstractDebugInterface.MESSAGE_TYPE_ERROR,text:message};
if(!this.redirectToConsole(completeMessage)){this.notifyChangeListeners(completeMessage)
}};
WGGObjectDebugInterface.prototype.warn=function(obj){if(this.lvl<WGGAbstractDebugInterface.LVL_WARN){return
}var message=this.createMessage(this.warn.caller,obj);
var completeMessage={type:WGGAbstractDebugInterface.MESSAGE_TYPE_WARN,text:message};
if(!this.redirectToConsole(completeMessage)){this.notifyChangeListeners(completeMessage)
}};
function WGGTextDebugInterface(verbose){var self=JSINER.extend(this,"WGGAbstractDebugInterface");
self.verbose=verbose;
self.lineSep=String.fromCharCode(13)+String.fromCharCode(10);
self.changeListeners=new Array();
return self
}WGGTextDebugInterface.prototype.createMessage=function(caller,obj){var message="";
if(obj!=null){message+=new WGGField(obj).toString()
}else{message+="[null]"
}if(this.verbose){if(caller!=null){message+=";";
message+="caller: [[["+new WGGMethod(caller).toString()+"]]]"+this.lineSep
}}message+=this.lineSep;
return message
};
WGGTextDebugInterface.prototype.info=function(obj){var message=this.createMessage(this.info.caller,obj);
this.notifyChangeListeners({type:WGGAbstractDebugInterface.MESSAGE_TYPE_INFO,text:message})
};
WGGTextDebugInterface.prototype.debug=function(obj){var message=this.createMessage(this.debug.caller,obj);
this.notifyChangeListeners({type:WGGAbstractDebugInterface.MESSAGE_TYPE_DEBUG,text:message})
};
WGGTextDebugInterface.prototype.error=function(obj){var message=this.createMessage(this.error.caller,obj);
this.notifyChangeListeners({type:WGGAbstractDebugInterface.MESSAGE_TYPE_ERROR,text:message})
};
WGGTextDebugInterface.prototype.warn=function(obj){var message=this.createMessage(this.warn.caller,obj);
this.notifyChangeListeners({type:WGGAbstractDebugInterface.MESSAGE_TYPE_WARN,text:message})
};
function WGGActionHistoryRecorder(size,bRecursive){this.undoManager=null;
this.jsoner=null;
this.undoProcessed=false;
this.lastState=null;
this.storableHashMap=null;
this.bRecursive=WGGDataTypeUtils.toBoolean(bRecursive);
this.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){this.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){this.debugInterface=new WGGNullDebugInterface()
}this.initialize=function(size){if(typeof Jsoner=="undefined"){throw new Error("JSONER (http://www.soft-amis.com/index.html?return=http://www.soft-amis.com/jsoner/) is undefined; please check the configuration of JSCore")
}this.undoManager=new UndoManager(size);
this.jsoner=new Jsoner();
this.storableHashMap=new WGGHashMap()
};
this.initialize(size)
}WGGActionHistoryRecorder.prototype.hasUndo=function(){if(this.undoManager==null){return false
}return this.undoManager.isUndoFound()
};
WGGActionHistoryRecorder.prototype.hasRedo=function(){if(this.undoManager==null){return false
}return this.undoManager.isRedoFound()
};
WGGActionHistoryRecorder.prototype.undo=function(){if(this.undoManager==null){return
}if(!this.hasUndo()){return
}this.undoProcessed=true;
this.debugInterface.debug("before callUndo");
this.undoManager.callUndo();
this.debugInterface.debug("after callUndo");
this.undoProcessed=false;
this.lastState=null
};
WGGActionHistoryRecorder.prototype.redo=function(){if(this.undoManager==null){return
}if(!this.hasRedo()){return
}this.undoProcessed=true;
this.undoManager.callRedo();
this.undoProcessed=false;
this.lastState=null
};
WGGActionHistoryRecorder.prototype.undoAll=function(){var id=null;
var time=200;
var self=this;
function autoUndo(){if(id!==null){window.clearTimeout(id);
id=null
}if(self.undoManager.isUndoFound()){id=window.setTimeout(function(){self.undoManager.callUndo();
autoUndo()
},time)
}else{self.undoProcessed=false;
self.lastState=null
}}this.undoProcessed=true;
while(this.undoManager.isRedoFound()){this.undoManager.callRedo()
}autoUndo()
};
WGGActionHistoryRecorder.prototype.redoAll=function(){var id=null;
var time=200;
var self=this;
function autoRedo(){if(id!==null){window.clearTimeout(id);
id=null
}if(self.undoManager.isRedoFound()){id=window.setTimeout(function(){self.undoManager.callRedo();
autoRedo()
},time)
}else{self.undoProcessed=false;
self.lastState=null
}}this.undoProcessed=true;
while(this.undoManager.isUndoFound()){this.undoManager.callUndo()
}autoRedo()
};
WGGActionHistoryRecorder.prototype.start=function(){this.run()
};
WGGActionHistoryRecorder.prototype.run=function(){var id=null;
var time=300;
var self=this;
function __getGroupName(aJson){var result=null;
var diff=self.jsoner.getDifference(aJson,self.lastState);
for(var name in diff){if(diff.hasOwnProperty(name)){if(result!==null){result=null;
break
}else{result=name
}}}return result
}function __storeObjects(){return self.storeObjects.apply(self,arguments)
}function __readObjects(){this.actionHistoryRecorderRef.readObjects.apply(this.actionHistoryRecorderRef,arguments)
}function __autoSaveFormState(){if(id!=null){window.clearTimeout(id);
id=null
}id=window.setTimeout(function(){var json=__storeObjects(self.bRecursive);
if(self.lastState==null){self.lastState=json
}else{if(!self.jsoner.isEquals(self.lastState,json)&&!self.undoProcessed){var group=__getGroupName(json);
var action=new UndoableAction(__readObjects,__readObjects,[json],[self.lastState],null,group);
self.debugInterface.debug("action created for group: "+group);
self.debugInterface.debug("doParams:");
self.debugInterface.debug(WGGDataTypeUtils.extend(json,{}));
self.debugInterface.debug("undoParams:");
self.debugInterface.debug(WGGDataTypeUtils.extend(self.lastState,{}));
action.actionHistoryRecorderRef=self;
self.undoManager.addAction(action);
self.lastState=json
}}__autoSaveFormState()
},time)
}__autoSaveFormState()
};
WGGActionHistoryRecorder.prototype.getUndoCount=function(){return this.undoManager.fUndoData.length
};
WGGActionHistoryRecorder.prototype.getRedoCount=function(){return this.undoManager.fRedoData.length
};
WGGActionHistoryRecorder.prototype.putStorable=function(name,storable){if(arguments.length!=2){throw new Error("arguments.length should be 2; was "+arguments.length)
}var name=arguments[0];
if(!WGGDataTypeUtils.isString(name)){throw new Error("arguments[0] should be string")
}var storable=arguments[1];
if(!WGGDataTypeUtils.instanceOf(storable,WGGStorable)){throw new Error("Object does not implement getState and setState methods (is not storable)")
}this.storableHashMap.put(name,storable)
};
WGGActionHistoryRecorder.prototype.storeObject=function(){if(arguments.length==0){throw new Error("arguments.length should be > 0")
}var storable=arguments[0];
if(!WGGDataTypeUtils.instanceOf(storable,WGGStorable)){throw new Error("Object does not implement getState and setState methods (is not storable)")
}var retVal=storable.getState();
return retVal
};
WGGActionHistoryRecorder.prototype.storeObjects=function(){if(this.storableHashMap==null){return{}
}var retVal={};
var keySet=this.storableHashMap.keyIterator();
while(keySet.hasNext()){var key=keySet.next();
var storable=this.storableHashMap.get(key);
retVal[key]=this.storeObject(storable,this.bRecursive)
}return retVal
};
WGGActionHistoryRecorder.prototype.readObject=function(){this.debugInterface.debug(">>>>>>> readObject");
if(arguments.length==0){throw new Error("arguments.length should be > 0")
}var storable=arguments[0];
if(!WGGDataTypeUtils.instanceOf(storable,WGGStorable)){throw new Error("Object does not implement setState and getState methods (is not storable)")
}var json=arguments[1];
if(json==null){throw new Error("json must not be null")
}this.debugInterface.debug(storable);
this.debugInterface.debug(json);
storable.setState(json);
if(this.bRecursive){for(var attr in storable){if(!WGGDataTypeUtils.instanceOf(storable[attr],WGGStorable)){continue
}this.readObject(storable[attr],json[attr])
}}};
WGGActionHistoryRecorder.prototype.readObjects=function(json){this.debugInterface.debug(">>>> readObjects");
if(arguments.length==0){throw new Error("arguments.length should be > 0")
}var json=arguments[0];
if(json==null){throw new Error("json must not be null")
}for(var attr in json){var storable=this.storableHashMap.get(attr);
this.readObject(storable,json[attr])
}};
function WGGAjaxLoader(){var self=JSINER.extend(this,"WGGSubject");
var bAvoidCacheTimeStamp=true;
var name=null;
var password=null;
switch(arguments.length){case 0:break;
case 1:if(WGGDataTypeUtils.isBoolean(arguments[0])){bAvoidCacheTimeStamp=arguments[0]
}break;
case 3:if(WGGDataTypeUtils.isBoolean(arguments[0])){bAvoidCacheTimeStamp=arguments[0]
}if(WGGDataTypeUtils.isString(arguments[1])){name=arguments[1]
}if(WGGDataTypeUtils.isString(arguments[2])){password=arguments[2]
}break;
default:throw new Error("number of arguments not sufficient to initialize WGGAjaxLoader")
}self.xmlHttp=false;
self.observers=[];
self.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){self.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){self.debugInterface=new WGGNullDebugInterface()
}self.bAvoidCacheTimeStamp=bAvoidCacheTimeStamp;
self.name=name;
self.password=password;
self.avoidCacheTimeStampParamName="avoidCacheTimeStamp";
return self
}WGGAjaxLoader.prototype.finalize=function(){if(this.xmlHttp==null){return 0
}var finalizedCount=this.removeObservers();
this.observers=null;
finalizedCount++;
WGGFinalizer.destroyWggClosuresByObject(this);
this.xmlHttp=null;
finalizedCount++;
return finalizedCount
};
WGGAjaxLoader.prototype.processRequest=function(){this.debugInterface.debug("WGGAjaxLoader.processRequest");
if(!this.xmlHttp){return[null]
}try{if(this.xmlHttp.readyState==4){this.debugInterface.debug("xmlHttp.status:"+this.xmlHttp.status);
if(this.xmlHttp.status==200||this.xmlHttp.status==0){var responseHeader=this.processResponseHeaders(this.xmlHttp.getAllResponseHeaders());
var cType=responseHeader["Content-Type"]||responseHeader["Content-type"];
if(cType==null){cType=""
}var xmlDoc=(cType.indexOf("text/xml")==-1&&cType.indexOf("application/xml")==-1)?this.xmlHttp.responseText:this.xmlHttp.responseXML;
this.debugInterface.debug("xml received");
this.debugInterface.debug(xmlDoc);
return[xmlDoc,responseHeader,this.xmlHttp.status]
}else{throw new Error("There was a problem retrieving the XML data from server: "+this.xmlHttp.statusText+" ("+this.xmlHttp.status+")")
}}}catch(e){this.debugInterface.error("error during xml processing");
this.debugInterface.error(e);
var responseHeader=this.processResponseHeaders(this.xmlHttp.getAllResponseHeaders());
this.debugInterface.error("responseHeader");
this.debugInterface.error(responseHeader);
return[e,responseHeader,this.xmlHttp.status]
}return[null]
};
WGGAjaxLoader.prototype.asyncHandler=function(){var retVal=this.processRequest();
this.notify.apply(this,retVal)
};
WGGAjaxLoader.prototype.processResponseHeaders=function(responseHeaderStr){if(responseHeaderStr==null){return null
}var responseHeaderLines=responseHeaderStr.split(/\n/g);
var responseHeader={};
for(var i=0;
i<responseHeaderLines.length;
i++){var responseHeaderLine=responseHeaderLines[i];
var pos=responseHeaderLine.indexOf(":");
if(pos==-1){continue
}responseHeader[WGGStringUtils.trim(responseHeaderLine.substring(0,pos))]=WGGStringUtils.trim(responseHeaderLine.substring(pos+1))
}return responseHeader
};
WGGAjaxLoader.prototype.initialize=function(){if(window.XMLHttpRequest){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead")
}catch(e){}try{this.xmlHttp=new XMLHttpRequest()
}catch(e){this.xmlHttp=false
}}else{if(window.ActiveXObject){try{this.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")
}catch(e){try{this.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")
}catch(e){this.xmlHttp=false
}}}else{throw"AJAX not supported"
}}};
WGGAjaxLoader.prototype.sendRequest=function(url,data,encoding,bAsync){this.debugInterface.debug("WGGAjaxLoader.sendRequest");
if(url==null){this.debugInterface.error("url is null");
this.notify();
return false
}if(!this.xmlHttp){this.debugInterface.error("xmlHttp is null or undefined");
this.notify();
return false
}if(typeof bAsync=="undefined"){bAsync=true
}if(!WGGDataTypeUtils.isBoolean(bAsync)){bAsync=true
}try{if(data!=null){this.debugInterface.debug("method POST");
if(this.name!=null&&WGGStringUtils.trim(this.name)!=""&&WGGStringUtils.trim(this.name)!="null"){this.xmlHttp.open("POST",url,bAsync,this.name,this.password)
}else{this.xmlHttp.open("POST",url,bAsync)
}var contentType="application/x-www-form-urlencoded";
if(encoding!=null){contentType+="; charset="+encoding
}else{}this.xmlHttp.setRequestHeader("Content-Type",contentType);
this.xmlHttp.setRequestHeader("Cache-Control","no-cache, must-revalidate")
}else{this.debugInterface.debug("method GET");
if(this.bAvoidCacheTimeStamp==true){if(url.indexOf(this.avoidCacheTimeStampParamName)!=-1){throw"the parameter "+this.avoidCacheTimeStampParamName+" is reserved; please use an another identifier"
}var pos=url.indexOf("?");
url+=(pos!=-1)?"&":"?";
url+=this.avoidCacheTimeStampParamName+"="+new Date().getTime()
}if(this.name!=null&&WGGStringUtils.trim(this.name)!=""){this.xmlHttp.open("GET",url,bAsync,this.name,this.password)
}else{this.xmlHttp.open("GET",url,bAsync)
}}if(bAsync==true){if(WGGBrowserDetector.IS_IE){this.xmlHttp.onreadystatechange=function(){this.asyncHandler()
}.__wggClosure(this)
}else{this.xmlHttp.onload=function(){this.asyncHandler()
}.__wggClosure(this)
}}this.debugInterface.debug("xmlHttp.send");
this.xmlHttp.send(data);
if(bAsync==false){this.asyncHandler()
}return true
}catch(e){this.debugInterface.error("exception: "+e);
this.notify(e)
}return false
};
WGGAjaxLoader.prototype.postXML=function(url,xmlDocument){if(url==null){this.notify();
return false
}if(!this.xmlHttp){this.notify();
return false
}try{if(this.name!=null&&WGGStringUtils.trim(this.name)!=""){this.xmlHttp.open("POST",url,true,this.name,this.password)
}else{this.xmlHttp.open("POST",url,true)
}this.xmlHttp.onreadystatechange=function(){this.asyncHandler()
}.__wggClosure(this);
this.xmlHttp.setRequestHeader("Man","POST "+url+" HTTP/1.1");
this.xmlHttp.setRequestHeader("MessageType","CALL");
this.xmlHttp.setRequestHeader("Content-Type","text/xml");
this.xmlHttp.send(xmlDocument);
return true
}catch(e){this.debugInterface.error("Error while posting XML");
this.debugInterface.error(e)
}this.notify();
return false
};
function WGGArray(data){this.data=null;
this.numAscComparator=function NumAscComparator(){var self=JSINER.extend(this,"WGGComparator");
self.compare=function(o1,o2){if(o1==o2){return 0
}if(o1>o2){return 1
}return -1
};
return self
};
if(WGGDataTypeUtils.isArray(data)){this.data=data
}else{this.data=new Array()
}}WGGArray.NUM_DESC_FUNC=function(a,b){return b-a
};
WGGArray.prototype.set=function(index,value){if(index<0){return false
}if(index>this.data.length){return false
}this.data[index]=value;
return true
};
WGGArray.prototype.getCapacity=function(){return this.length()
};
WGGArray.prototype.add=function(value){this.data[this.data.length]=value
};
WGGArray.prototype.reset=function(){this.data=new Array()
};
WGGArray.prototype.length=function(){return this.data.length
};
WGGArray.prototype.getArray=function(){return this.data
};
WGGArray.prototype.getNormalizedArray=function(sortFunction){var countRemoved=0;
var ret=this.clone();
try{ret.sort(sortFunction)
}catch(e){ret.sort()
}var flags=new Array();
for(var i=ret.length-1;
i>0;
i--){var bEquals=false;
try{bEquals=ret[i].equals(ret[i-1])
}catch(e){bEquals=ret[i]==ret[i-1]
}if(bEquals){flags[i]=false;
countRemoved++
}else{flags[i]=true
}}flags[0]=true;
var ret2=new Array();
var j=0;
for(var i=0;
i<ret.length;
i++){if(flags[i]){ret2[j]=ret[i];
j++
}}return ret2
};
WGGArray.prototype.get=function(index){if(index<0||index>this.data.length){throw"Invalid index: "+index
}return this.data[index]
};
WGGArray.prototype.clone=function(){var c=new Array();
for(var i=0;
i<this.data.length;
i++){c[i]=this.data[i]
}return c
};
WGGArray.prototype.contains=function(needle){for(var i=0;
i<this.data.length;
i++){var bEquals=false;
try{bEquals=this.data[i].equals(needle)
}catch(e){bEquals=(this.data[i]==needle)
}if(bEquals){return true
}}return false
};
WGGArray.prototype.indexOf=function(needle){for(var i=0;
i<this.data.length;
i++){var bEquals=false;
try{bEquals=this.data[i].equals(needle)
}catch(e){bEquals=this.data[i]==needle
}if(bEquals){return i
}}return -1
};
WGGArray.prototype.remove=function(needle){for(var i=0;
i<this.data.length;
i++){var removedElement=null;
var bEquals=false;
try{bEquals=this.data[i].equals(needle)
}catch(e){bEquals=this.data[i]==needle
}if(bEquals){removedElement=this.data[i];
var firstPart=this.data.slice(0,i);
var secondPart=new Array();
if(i<(this.data.length-1)){secondPart=this.data.slice(i+1)
}this.data=firstPart.concat(secondPart);
return removedElement
}}return null
};
WGGArray.prototype.removeAt=function(index){if(index<0){throw"OutOfBoundsException: index must not be negative"
}if(index>(this.data.length-1)){throw"OutOfBoundsException: index must not be greater than last index"
}var removedElement=this.data[index];
var firstPart=this.data.slice(0,index);
var secondPart=new Array();
if(index<(this.data.length-1)){secondPart=this.data.slice(index+1)
}this.data=firstPart.concat(secondPart);
return removedElement
};
WGGArray.prototype.containsAll=function(arr){if(!WGGDataTypeUtils.instanceOf(arr,WGGArray)){return false
}for(var i=0;
i<arr.length();
i++){if(!this.contains(arr.get(i))){return false
}}return true
};
WGGArray.prototype.retainAll=function(arr){if(!WGGDataTypeUtils.instanceOf(arr,WGGArray)){return
}var newArr=[];
for(var i=0;
i<arr.length();
i++){if(!this.contains(arr.get(i))){continue
}newArr.push(arr.get(i))
}this.reset();
this.data=newArr
};
WGGArray.prototype.addAll=function(arr){if(!WGGDataTypeUtils.instanceOf(arr,WGGArray)){return
}for(var i=0;
i<arr.length();
i++){if(this.contains(arr.get(i))){continue
}this.add(arr.get(i))
}};
WGGArray.prototype.swap=function(a,b,onSwap,comparator){if(a==b){return
}var tmp=this.data[a];
this.data[a]=this.data[b];
this.data[b]=tmp;
if(WGGDataTypeUtils.isFunction(onSwap)){onSwap.call(null,a,b)
}};
WGGArray.prototype.partition=function(begin,end,pivot,onSwap,comparator){var piv=this.data[pivot];
this.swap(pivot,end-1,onSwap,comparator);
var store=begin;
var theComparator=(comparator==null)?(new this.numAscComparator()):comparator;
for(var ix=begin;
ix<end-1;
++ix){if(theComparator.compare(this.data[ix],piv)<0){this.swap(store,ix,onSwap,comparator);
++store
}}this.swap(end-1,store,onSwap,comparator);
return store
};
WGGArray.prototype.qsort=function(begin,end,onSwap,comparator){if(end-1>begin){var pivot=begin+Math.floor(Math.random()*(end-begin));
pivot=this.partition(begin,end,pivot,onSwap,comparator);
this.qsort(begin,pivot,onSwap,comparator);
this.qsort(pivot+1,end,onSwap,comparator)
}};
WGGArray.prototype.finalize=function(){var j=0;
if(this.data!=null){while(this.data.length>0){var e=this.data.pop();
if(typeof e.finalize=="function"){j+=e.finalize()
}e=null;
j++
}this.data=null
}this.numAscComparator=null;
return ++j
};
WGGArray.prototype.toString=function(){return this.data.toString()
};
WGGArray.NumberDescComparator=function(){var self=JSINER.extend(this,"WGGComparator");
self.compare=function(o1,o2){if(o1==null&&o2==null){return 0
}if(o1==null&&o2!=null){return 1
}if(o1!=null&&o2==null){return -1
}if(o1>o2){return -1
}return 1
};
return self
};
var WGGBrowserDetector=new function _WGGBrowserDetector(){this.OS="";
this.browser="";
this.version="";
this.theString="";
this.theUserAgent=navigator.userAgent.toLowerCase();
this.checkIt=function(string){place=this.theUserAgent.indexOf(string)+1;
this.theString=string;
return place
};
this.toString=function(){return"OS: "+this.OS+",Browser: "+this.browser+",version: "+this.version
};
this.detect=function(){if(this.checkIt("konqueror")){this.browser="Konqueror";
this.OS="Linux"
}else{if(this.checkIt("safari")){this.browser="Safari"
}else{if(this.checkIt("omniweb")){this.browser="OmniWeb"
}else{if(this.checkIt("opera")){this.browser="Opera"
}else{if(this.checkIt("webtv")){this.browser="WebTV"
}else{if(this.checkIt("icab")){this.browser="iCab"
}else{if(this.checkIt("msie")){this.browser="Internet Explorer"
}else{if(this.checkIt("firefox")){this.browser="Firefox"
}else{if(!this.checkIt("compatible")){this.browser="Netscape Navigator";
this.version=this.theUserAgent.charAt(8)
}else{this.browser="An unknown browser"
}}}}}}}}}if(!this.version){this.version="";
var allNumbers="0123456789";
var startPos=place+this.theString.length;
var j=startPos;
while(j<this.theUserAgent.length){var ch=this.theUserAgent.charAt(j);
if(ch=="."||allNumbers.search(ch)!=-1){this.version+=ch
}else{break
}j++
}}if(!this.OS){if(this.checkIt("linux")){this.OS="Linux"
}else{if(this.checkIt("x11")){this.OS="Unix"
}else{if(this.checkIt("mac")){this.OS="Mac"
}else{if(this.checkIt("win")){this.OS="Windows"
}else{this.OS="an unknown operating system"
}}}}}}
};
WGGBrowserDetector.detect();
WGGBrowserDetector.IS_NAV=false;
WGGBrowserDetector.IS_IE=(WGGBrowserDetector.browser=="Internet Explorer");
WGGBrowserDetector.IS_OPERA=(WGGBrowserDetector.browser=="Opera");
if(!(WGGBrowserDetector.IS_IE||WGGBrowserDetector.IS_OPERA)){WGGBrowserDetector.IS_NAV=true
}var isNav=false;
var isIE=(WGGBrowserDetector.browser=="Internet Explorer");
var isOpera=(WGGBrowserDetector.browser=="Opera");
if(!isIE){isNav=true
};
function WGGComparator(){}WGGComparator.prototype.compare=function(o1,o2){throw new Error("WGGComparator is abstract, implement compare method")
};
function WGGDataFormatUtils(){}WGGDataFormatUtils.AbstractFormatter=function(){this.args=[];
this.format=function(){return null
}
};
WGGDataFormatUtils.CustomTemplateFormatter=function(){var self=JSINER.extend(this,WGGDataFormatUtils.AbstractFormatter);
self.args=[];
for(var i=0;
i<arguments.length;
i++){self.args[i]=arguments[i]
}self.format=function(str){if(str==null){return null
}var template=(this.args.length>0)?this.args[0]:null;
if(template==null){return str
}var splitRegex=(this.args.length>1)?this.args[1]:null;
var sTemplate=new WGGSimpleTemplate(template);
var pieces=[str];
if(splitRegex!=null){pieces=str.split(splitRegex)
}var i=0;
while(sTemplate.hasEmptyPlaceholders()&&i<pieces.length){sTemplate.assign(pieces[i]);
i++
}return sTemplate.getResult()
};
return self
};
WGGDataFormatUtils.RoundDownwardsFormatter=function(){var self=JSINER.extend(this,WGGDataFormatUtils.AbstractFormatter);
self.args=[];
for(var i=0;
i<arguments.length;
i++){self.args[i]=arguments[i]
}self.format=function(str,dp){if(str==null){return null
}try{str=(new String(""+str)).replace(",",".");
var value=parseFloat(str);
if(typeof dp=="undefined"){dp=2
}if(dp<1||dp>14){return value
}var factor=Math.pow(10,dp);
var tmp=(Math.round(value*factor)/factor).toString();
tmp=tmp.replace(/\./g,",");
if(tmp.indexOf(",")==-1){tmp+=","
}tmp+=factor.toString().substring(1);
return tmp.substring(0,tmp.indexOf(",")+dp+1)
}catch(e){throw e
}};
return self
};
WGGDataFormatUtils.SimpleNumberFormatFormatter=function(){var self=JSINER.extend(this,WGGDataFormatUtils.AbstractFormatter);
self.args=[];
for(var i=0;
i<arguments.length;
i++){self.args[i]=arguments[i]
}self.format=function(str){if(str==null){return null
}str=(new String(""+str)).replace(",",".");
var doubleRegExp=new RegExp("-?[0-9]+(.[0-9]*)?","g");
if(!doubleRegExp.exec(str)){return str
}var bIsNegative=(str.indexOf("-")==0);
var minus="";
if(bIsNegative){str=str.substring(1);
minus="-"
}str=str.replace(/\./,",");
var beforeComma="";
var afterComma=""+str;
var commaPos=str.indexOf(",");
if(commaPos!=-1){beforeComma=str.substring(0,commaPos);
afterComma=str.substring(commaPos)
}else{beforeComma=str;
afterComma=""
}var end=beforeComma.length;
var start=beforeComma.length-3;
if(start<1){return minus+beforeComma+afterComma
}var result="";
do{var substr=beforeComma.substring(start,end);
start-=3;
if(start<0){start=0
}end-=3;
var tmp=substr;
if(result!=""){tmp+="."+result
}result=tmp
}while(end>0);
if(afterComma.length>0){result+=afterComma
}return minus+result
};
return self
};
WGGDataFormatUtils.CombinedFormatter=function(){var self=JSINER.extend(this,WGGDataFormatUtils.AbstractFormatter);
self.args=[];
for(var i=0;
i<arguments.length;
i++){self.args[i]=arguments[i]
}self.format=function(str,dp){var retVal=str;
for(var i=0;
i<self.args.length;
i++){var arg=self.args[i];
retVal=arg.format.apply(arg,[retVal,dp])
}return retVal
};
return self
};
function WGGDataTypeUtils(){}WGGDataTypeUtils.isObject=function(a){return(a&&typeof a=="object")||WGGDataTypeUtils.isFunction(a)
};
WGGDataTypeUtils.isFunction=function(a){return typeof a=="function"
};
WGGDataTypeUtils.isArray=function(a){return WGGDataTypeUtils.isObject(a)&&a.constructor==Array
};
WGGDataTypeUtils.isString=function(a){return(typeof a=="string"||a instanceof String)
};
WGGDataTypeUtils.isNumeric=function(a){var regExp=/^(-)?(\d*)(\.?)(\d*)$/;
return((new String(a)).search(regExp)!=-1)
};
WGGDataTypeUtils.isNumber=function(a){return typeof a=="number"
};
WGGDataTypeUtils.isUndefined=function(a){return typeof a=="undefined"
};
WGGDataTypeUtils.isBoolean=function(a){return(a==false||a==true)
};
WGGDataTypeUtils.isRegExp=function(a){return a instanceof RegExp
};
WGGDataTypeUtils.toBoolean=function(value){if(value==null){return false
}if(value===true||value===false){return value
}if(value==1){return true
}if(!WGGDataTypeUtils.isString(value)){return false
}value=value.toUpperCase();
if(value=="TRUE"||value=="1"){return true
}return false
};
WGGDataTypeUtils.areEquals=function(obj0,obj1){return COMMONS.isEquals(obj0,obj1)
};
WGGDataTypeUtils.instanceOf=function(obj,fClass){if(obj==null||fClass==null){return false
}if(obj.constructor==null){return false
}if(fClass.prototype!=null){if(obj.constructor==fClass.prototype.constructor){return true
}}var className=WGGReflection.createMember(fClass).getName();
var constr=obj.constructor;
if(constr){var constrStr=constr.toString();
var pieces=constrStr.split("\n");
for(var i=0;
i<pieces.length;
i++){var piece=pieces[i];
var matches=/JSINER.extend((.+),(.*)\);)/.exec(piece);
if(!matches){continue
}if(!matches[3]){continue
}var match=WGGStringUtils.trim(matches[3].replace(/\"/g,""));
if(className==match){return true
}}}return false
};
WGGDataTypeUtils.couldBeInstanceOf=function(obj,fClass){var debug=new WGGNullDebugInterface();
debug.info("WGGDataTypeUtils.couldBeInstanceOf");
debug.info(obj);
if(obj==null||fClass==null){debug.warn("obj or fClass is null; return false");
return false
}if(!WGGReflection.isMethod(fClass)){debug.warn("fClass is not a Function object");
return false
}var fClassObj=new fClass();
var fClassMembers=new WGGArray();
for(var member in fClassObj){fClassMembers.add(member)
}var nMatchedMembers=0;
for(var member in obj){if(fClassMembers.contains(member)){nMatchedMembers++
}}debug.info("number of fClass members is "+fClassMembers.length()+"; matched members are "+nMatchedMembers);
debug.warn("return "+((nMatchedMembers!=0)&&(nMatchedMembers==fClassMembers.length())));
return((nMatchedMembers!=0)&&(nMatchedMembers==fClassMembers.length()))
};
WGGDataTypeUtils.extend=function(source,destination){destination=destination||{};
if(!source){return destination
}for(var property in source){var value=source[property];
if(typeof value!="undefined"){destination[property]=value
}}return destination
};
WGGDataTypeUtils.isPrimitive=function(obj){try{if(typeof obj=="object"){var i=0;
try{for(var attr in obj){if(i==0){return false
}}}catch(e){return false
}return true
}return(typeof obj=="string"||typeof obj=="number"||typeof obj=="boolean")
}catch(ex){return true
}};
WGGDataTypeUtils.detectCycles=function(member,node,cycleMembersCache,cycleNodesCache,bExitWhenOneCycleIsFound){if(WGGDataTypeUtils.detectCycles.__bMaxNumberReached){return false
}if(member==null){return false
}if(node==null){return false
}if(WGGDataTypeUtils.isPrimitive(node)){return false
}if(cycleMembersCache==null){return false
}if(cycleNodesCache==null){return false
}if(typeof bExitWhenOneCycleIsFound=="undefined"){bExitWhenOneCycleIsFound=true
}var _hashCodes=WGGDataTypeUtils.detectCycles.__hashCodes;
if(!_hashCodes){_hashCodes=WGGDataTypeUtils.detectCycles.__hashCodes={}
}var _a=WGGDataTypeUtils.detectCycles.__internalCycleMembersCache;
if(!_a){_a=WGGDataTypeUtils.detectCycles.__internalCycleMembersCache=[]
}var _b=WGGDataTypeUtils.detectCycles.__internalCycleNodesCache;
if(!_b){_b=WGGDataTypeUtils.detectCycles.__internalCycleNodesCache=[]
}if(!WGGDataTypeUtils.detectCycles.__i){WGGDataTypeUtils.detectCycles.__i=0
}WGGDataTypeUtils.detectCycles.__i++;
if(WGGDataTypeUtils.detectCycles.__i>1000){WGGDataTypeUtils.detectCycles.__bMaxNumberReached=true;
return false
}for(var i=0;
i<_b.length;
i++){if(_b[i]==node){var cycleMembersTmpCache=_a.slice(i,_a.length).concat([member+" (CYCLE)"]);
var hashCode=WGGStringUtils.hashCode(cycleMembersTmpCache);
if(_hashCodes[hashCode]){WGGDataTypeUtils.detectCycles.__internalCycleMembersCache=[];
WGGDataTypeUtils.detectCycles.__internalCycleNodesCache=[];
return false
}cycleMembersCache.push(cycleMembersTmpCache);
cycleNodesCache.push(_b.slice(i,_b.length).concat([node]));
_hashCodes[hashCode]=true;
WGGDataTypeUtils.detectCycles.__hashCodes=_hashCodes;
WGGDataTypeUtils.detectCycles.__internalCycleMembersCache=[];
WGGDataTypeUtils.detectCycles.__internalCycleNodesCache=[];
return true
}}_a.push(member);
_b.push(node);
var bCycleDetected=false;
try{var l=-1;
try{l=node.length
}catch(ex){WGGAbstractDebugInterface.gDebugInterface.warn("1")
}if(l&&l!=-1){for(var i=0;
i<l;
i++){if(WGGDataTypeUtils.detectCycles.__bMaxNumberReached){break
}var subNode=node[i];
if(!subNode){continue
}var nodeType=-1;
var tagName=null;
try{tagName=subNode.tagName;
nodeType=subNode.nodeType;
if(tagName&&nodeType!=1){continue
}}catch(exx){if(exx.name=="InternalError"){WGGDataTypeUtils.detectCycles.__bMaxNumberReached=true;
break
}continue
}try{if(WGGDataTypeUtils.detectCycles(i,subNode,cycleMembersCache,cycleNodesCache,bExitWhenOneCycleIsFound)===true){bCycleDetected=true;
if(bExitWhenOneCycleIsFound==true){break
}}}catch(exx){if(exx.name=="InternalError"){WGGDataTypeUtils.detectCycles.__bMaxNumberReached=true;
break
}}}}else{for(var member in node){if(WGGDataTypeUtils.detectCycles.__bMaxNumberReached){break
}if(member=="offsetParent"){continue
}if(member=="ownerDocument"){continue
}if(member=="ownerElement"){continue
}if(member=="parentNode"){continue
}if(member=="previousSibling"){continue
}if(member=="nextSibling"){continue
}if(member=="previousElementSibling"){continue
}if(member=="nextElementSibling"){continue
}if(member=="firstElementChild"){continue
}if(member=="lastElementChild"){continue
}if(member=="firstChild"){continue
}if(member=="lastChild"){continue
}if(member=="owner"){continue
}if(member=="parentTextEdit"){continue
}if(member=="offsetParent"){continue
}if(member=="parentElement"){continue
}if(member=="document"){continue
}if(member=="all"){continue
}if(member=="_"){continue
}if(member=="children"){continue
}try{var t=node[member]
}catch(ex){continue
}if(typeof node[member]=="string"){continue
}if(typeof node[member]=="number"){continue
}if(typeof node[member]=="function"){continue
}if(node[member]===true){continue
}if(node[member]===false){continue
}if(node[member]==null){continue
}if(WGGDataTypeUtils.detectCycles(member,node[member],cycleMembersCache,cycleNodesCache,bExitWhenOneCycleIsFound)===true){bCycleDetected=true;
if(bExitWhenOneCycleIsFound==true){break
}}}}}catch(e){if(e.name=="InternalError"){WGGDataTypeUtils.detectCycles.__bMaxNumberReached=true
}}if(bCycleDetected===false){_a.pop(member);
_b.pop(node)
}return bCycleDetected
};
WGGDataTypeUtils.toUnifiedErrObject=function(obj){var retVal=new function WGGUnifiedErrObject(){this.message=null;
this.sourceURL=null,this.sourceLineNo=null,this.stacktrace=null,this.toString=function(){var str=this.message;
if(this.sourceURL&&this.sourceLineNo){str+=" ("+this.sourceURL+": "+this.sourceLineNo+")"
}return str
}
};
if(obj==null){return retVal
}if(WGGDataTypeUtils.isString(obj)){retVal.message=obj;
return retVal
}if(!obj.message){retVal.message=obj.toString();
return retVal
}retVal.message=obj.message;
retVal.sourceURL=obj.fileName||obj.sourceURL||null;
retVal.sourceLineNo=obj.lineNumber||obj.line||null;
retVal.stacktrace=obj.stack||null;
return retVal
};
function WGGFinalizer(){}WGGFinalizer.finalize=function(){if(arguments.length==0){return 0
}var obj=arguments[0];
if(obj==null){return 0
}var count=0;
try{for(var a in obj){var child=obj[a];
try{if(child==null){continue
}if(WGGDataTypeUtils.isArray(child)){while(child.length>0){var element=child.pop();
if(WGGDataTypeUtils.isPrimitive(element)){break
}count+=WGGFinalizer.finalize(element)
}count++
}else{if(child.finalize&&typeof child.finalize=="function"){count+=child.finalize()
}else{if(child.modelNode&&child.viewNode){bb.destruct(child);
count++
}else{count++
}}}obj[a]=null;
delete obj[a]
}catch(ex){if(typeof WGGAbstractDebugInterface=="function"){WGGAbstractDebugInterface.gDebugInterface.error(ex)
}if(console){console.log(ex)
}}}}catch(e){if(typeof WGGAbstractDebugInterface=="function"){WGGAbstractDebugInterface.gDebugInterface.error(ex)
}if(console){console.log(e)
}}return count
};
WGGFinalizer.clear=function(){if(arguments.length==0){return 0
}var obj=arguments[0];
if(obj==null){return 0
}var count=0;
try{for(var a in obj){try{obj[a]=null;
delete obj[a];
count++
}catch(ex){if(typeof WGGAbstractDebugInterface=="function"){WGGAbstractDebugInterface.gDebugInterface.error(ex)
}}}}catch(e){if(typeof WGGAbstractDebugInterface=="function"){WGGAbstractDebugInterface.gDebugInterface.error(ex)
}}return count
};
WGGFinalizer.destroyWggClosuresByObject=function(){if(arguments.length==0){return 0
}var obj=arguments[0];
if(obj==null){return 0
}var count=0;
for(var i=0;
i<window.__objs.length;
i++){var __obj=window.__objs[i];
if(!__obj){continue
}if(__obj==obj){var __closures=__obj.__closures;
if(__closures){while(__closures.length>0){var __closure=__closures.pop();
__closure=null
}__obj.__closures=null
}window.__objs[i]=null;
delete window.__objs[i];
__obj=null;
count++
}}return count
};
WGGFinalizer.destroyWggClosuresByAttrs=function(){if(arguments.length==0){return 0
}var attrs=arguments[0];
if(attrs==null){return 0
}var count=0;
for(var i=0;
i<window.__objs.length;
i++){var __obj=window.__objs[i];
if(!__obj){continue
}var bMatched=true;
for(var attrName in attrs){if(__obj[attrName]!=attrs[attrName]){bMatched=false;
break
}}if(bMatched){var __closures=__obj.__closures;
if(__closures){while(__closures.length>0){var __closure=__closures.pop();
__closure=null
}__obj.__closures=null
}window.__objs[i]=null;
delete window.__objs[i];
__obj=null;
count++
}}return count
};
function WGGHashMap(){var internalMap={};
var length=0;
if(arguments.length>0){var arg0=arguments[0];
if(WGGDataTypeUtils.isObject(arg0)){internalMap=arg0;
for(var k in arg0){length++
}}}this.hashMap=new Array(internalMap);
this.length=length;
this.currentIndex=-1
}WGGHashMap.prototype.isKeyValid=function(key){return(WGGDataTypeUtils.isString(key)||WGGDataTypeUtils.isNumeric(key))
};
WGGHashMap.prototype.clear=function(){this.hashMap=new Array(new Object());
this.length=0;
this.currentIndex=-1
};
WGGHashMap.prototype.containsKey=function(key){if(!this.isKeyValid(key)){return false
}for(var currentKey in this.hashMap[0]){if(currentKey==key){return true
}}return false
};
WGGHashMap.prototype.containsValue=function(value){for(var currentKey in this.hashMap[0]){if(this.hashMap[0][currentKey]==value){return true
}}return false
};
WGGHashMap.prototype.entryIterator=function(){var entryArray=new Array();
for(var currentKey in this.hashMap[0]){entryArray.push(this.hashMap[0][currentKey])
}var iterator=new WGGListIterator();
iterator.setInternalArray(entryArray);
return iterator
};
WGGHashMap.prototype.get=function(key){if(!this.isKeyValid(key)){return null
}return this.hashMap[0][key]
};
WGGHashMap.prototype.isEmpty=function(){var counter=0;
for(var currentKey in this.hashMap[0]){if(counter>0){break
}counter++
}return(counter==0)
};
WGGHashMap.prototype.keyIterator=function(){var keyArray=new Array();
for(var currentKey in this.hashMap[0]){keyArray.push(currentKey)
}var iterator=new WGGListIterator();
iterator.setInternalArray(keyArray);
return iterator
};
WGGHashMap.prototype.put=function(key,value){if(!this.isKeyValid(key)){return false
}var currentValue=this.hashMap[0][key];
if(!this.containsKey(key)){this.length++
}this.hashMap[0][key]=value;
if(WGGDataTypeUtils.isArray(value)){var arr=new Array();
for(var i=0;
i<value.length;
i++){arr.push(value[i])
}this.hashMap[0][key]=arr
}return currentValue
};
WGGHashMap.prototype.remove=function(key){if(!this.isKeyValid(key)){return null
}try{oldEntry=this.hashMap[0][key];
delete this.hashMap[0][key];
this.length--;
return oldEntry
}catch(e){return null
}};
WGGHashMap.prototype.size=function(){return this.length
};
WGGHashMap.prototype.toString=function(){if(arguments.length==3){var keys=arguments[0];
var firstOnly=new Boolean(arguments[1]);
var delimiter=new String(arguments[2]);
var aItem="";
for(var i=0;
i<keys.length;
i++){var theItem=this.get(keys[i]);
if(theItem){if(aItem!=""){aItem+=delimiter
}aItem+=theItem;
if(firstOnly==true){break
}}}return aItem
}var str="";
if(this.length!=0){var arr=this.hashMap[0];
for(var key in arr){if(str!=""){str+=";"
}var val=this.hashMap[0][key];
if(val==null){val="null"
}if(typeof val=="object"){val=val.toString()
}str+=key+"="+val
}}return str
};
WGGHashMap.prototype.sortByKey=function(){throw new Error("sortByKey not yet implemented")
};
WGGHashMap.prototype.sortByEntry=function(){var comparator=null;
if(arguments.length>0){var arg=arguments[0];
if(WGGDataTypeUtils.instanceOf(arg,WGGComparator)){comparator=arg
}}var keyArray=new Array();
var entryArray=new WGGArray();
for(var currentKey in this.hashMap[0]){keyArray.push(currentKey);
entryArray.add(this.hashMap[0][currentKey])
}entryArray.qsort(0,entryArray.length(),function(a,b){var tmp=keyArray[a];
keyArray[a]=keyArray[b];
keyArray[b]=tmp
},comparator);
var newHashMap=new Array(new Object());
for(var i=0;
i<keyArray.length;
i++){newHashMap[0][keyArray[i]]=entryArray.get(i)
}this.hashMap=newHashMap;
this.currentIndex=-1
};
WGGHashMap.prototype.toSimpleMap=function(){var sMap={};
for(var currentKey in this.hashMap[0]){sMap[currentKey]=this.hashMap[0][currentKey]
}return sMap
};
WGGHashMap.prototype.finalize=function(){var j=0;
if(this.hashMap!=null){var o=this.hashMap[0];
for(var a in o){var e=o[a];
if(e==null){continue
}if(typeof e.finalize=="function"){j+=e.finalize()
}e=null;
delete o[a];
j++
}this.length=0;
this.currentIndex=-1;
j+=2
}return j
};
function WGGHashMapExt(){this.keys=[];
this.values=[];
this.isValid=function(){if(!(this.keys!=null&&this.values!=null)){return false
}return(this.keys.length==this.values.length)
}
}WGGHashMapExt.prototype.isKeyValid=function(key){return typeof key!="undefined"
};
WGGHashMapExt.prototype.clear=function(){this.keys=[];
this.values=[]
};
WGGHashMapExt.prototype.containsKey=function(key){if(!this.isValid()){throw new Error("Implementation error or violation of the public access policy: keys.length != values.length")
}if(!this.isKeyValid(key)){return false
}for(var i=0;
i<this.keys.length;
i++){if(this.keys[i]==key){return true
}}return false
};
WGGHashMapExt.prototype.containsValue=function(value){if(!this.isValid()){throw new Error("Implementation error or violation of the public access policy: keys.length != values.length")
}for(var i=0;
i<this.values.length;
i++){if(this.values[i]==value){return true
}}return false
};
WGGHashMapExt.prototype.entryIterator=function(){if(!this.isValid()){throw new Error("Implementation error or violation of the public access policy: keys.length != values.length")
}var iterator=new WGGListIterator();
iterator.setInternalArray(this.values);
return iterator
};
WGGHashMapExt.prototype.get=function(key){if(!this.isValid()){throw new Error("Implementation error or violation of the public access policy: keys.length != values.length")
}if(!this.isKeyValid(key)){return null
}var index=-1;
for(var i=0;
i<this.keys.length;
i++){if(this.keys[i]==key){index=i;
break
}}if(index==-1){return null
}return this.values[index]
};
WGGHashMapExt.prototype.isEmpty=function(){if(!this.isValid()){throw new Error("Implementation error or violation of the public access policy: keys.length != values.length")
}return this.keys.length==0
};
WGGHashMapExt.prototype.keyIterator=function(){if(!this.isValid()){throw new Error("Implementation error or violation of the public access policy: keys.length != values.length")
}var iterator=new WGGListIterator();
iterator.setInternalArray(this.keys);
return iterator
};
WGGHashMapExt.prototype.put=function(key,value){if(!this.isValid()){throw new Error("Implementation error or violation of the public access policy: keys.length != values.length")
}if(!this.isKeyValid(key)){return false
}this.keys[this.keys.length]=key;
this.values[this.values.length]=value;
return true
};
WGGHashMapExt.prototype.remove=function(key){if(!this.isValid()){throw new Error("Implementation error or violation of the public access policy: keys.length != values.length")
}if(!this.isKeyValid(key)){return null
}try{var dIndex=-1;
for(var i=0;
i<this.keys.length;
i++){if(this.keys[i]==key){dIndex=i;
break
}}if(dIndex==-1){return null
}var keysArr=new WGGArray(this.keys);
var valuesArr=new WGGArray(this.values);
keysArr.removeAt(dIndex);
var retVal=valuesArr.removeAt(dIndex);
this.keys=keysArr.getArray();
this.values=valuesArr.getArray();
return retVal
}catch(e){return null
}};
WGGHashMapExt.prototype.size=function(){if(!this.isValid()){throw new Error("Implementation error or violation of the public access policy: keys.length != values.length")
}return this.keys.length
};
WGGHashMapExt.prototype.toString=function(){if(!this.isValid()){throw new Error("Implementation error or violation of the public access policy: keys.length != values.length")
}if(this.keys==null){return""
}if(this.keys.length==0){return""
}var str="";
for(var i=0;
i<this.keys.length;
i++){if(i>0){str+=";"
}var value=this.values[i];
str+=this.keys[i].toString()+"="+((value==null)?"null":value.toString())
}return str
};
WGGHashMapExt.prototype.sortByKey=function(){};
WGGHashMapExt.prototype.sortByEntry=function(){if(!this.isValid()){throw new Error("Implementation error or violation of the public access policy: keys.length != values.length")
}var keyArray=this.keys;
var entryArray=new WGGArray(this.values);
entryArray.qsort(0,entryArray.length(),function(a,b){var tmp=keyArray[a];
keyArray[a]=keyArray[b];
keyArray[b]=tmp
});
this.keys=keyArray;
this.values=entryArray.getArray()
};
function WGGHtmlUtils(){}WGGHtmlUtils.htmlSpecialChars=function(sString){if(sString==null||sString==""){return sString
}if(!WGGDataTypeUtils.isString(sString)){return sString
}sString=sString.replace(/\&(?!amp;|#[0-9]+)/g,"&amp;");
sString=sString.replace(/\"/g,"&quot;");
sString=sString.replace(/\'/g,"&#039;");
sString=sString.replace(/</g,"&lt;");
sString=sString.replace(/>/g,"&gt;");
return sString
};
WGGHtmlUtils.htmlSpecialCharsDecode=function(sString){if(sString==null||sString==""){return sString
}if(!WGGDataTypeUtils.isString(sString)){return sString
}sString=sString.replace(/\&amp;/g,"&");
sString=sString.replace(/\&quot;/g,'"');
sString=sString.replace(/\&#039;/g,"'");
sString=sString.replace(/\&lt;/g,"<");
sString=sString.replace(/\&gt;/g,">");
sString=sString.replace(/\&#13;/g,"\r");
sString=sString.replace(/\&#10;/g,"\n");
return sString
};
WGGHtmlUtils.buildURLFromCurrentPath=function(scriptName){var url=location.protocol+"//"+location.host;
if(scriptName==null){return url
}if(scriptName.indexOf("/")==0){url+=scriptName
}else{var pos=location.pathname.lastIndexOf("/");
var path=(pos!=-1)?location.pathname.substring(0,pos):location.pathname;
url+=path+"/"+scriptName
}return url
};
WGGHtmlUtils.buildURL=function(scriptName,paramsObj){if(scriptName==null){return""
}var url=scriptName;
var i=0;
for(var paramName in paramsObj){if(i==0){if(url.length>0){url+="?"
}}else{url+="&"
}url+=paramName+"="+encodeURIComponent(paramsObj[paramName]);
i++
}return url
};
WGGHtmlUtils.extractQueryString=function(getRequest){if(getRequest==null){return null
}var start=getRequest.indexOf("?");
var queryString="";
if(start==-1){queryString=getRequest
}else{if(start<getRequest.length-1){queryString=getRequest.substr(start+1)
}}return queryString
};
WGGHtmlUtils.explodeGetParams=function(getRequest){var queryString=WGGHtmlUtils.extractQueryString(getRequest);
var paramArr={};
var params=queryString.split("&");
for(var i=0;
i<params.length;
i++){var param=params[i];
var parts=param.split("=");
if(parts.length<2){paramArr[parts[0]]=null;
continue
}paramArr[parts[0]]=decodeURIComponent(parts[1])
}return paramArr
};
WGGHtmlUtils.getCurrentScriptName=function(){var pos=location.pathname.lastIndexOf("/");
if(pos==-1){return location.pathname
}if((pos+1)<location.pathname.length){return location.pathname.substring(pos+1)
}return""
};
WGGHtmlUtils.getElementsByClassName=function(){if(arguments.length<3){return null
}var oElm=arguments[0];
if(oElm==null){return null
}var strTagName=arguments[1];
var strClassName=arguments[2];
var bReturnWhenOneElementFound=(arguments.length>3)?WGGDataTypeUtils.toBoolean(arguments[3]):true;
if(document.getElementsByClassName){var elements=oElm.getElementsByClassName(strClassName);
var filteredElements=null;
if(typeof Array.filter!="undefined"){var filteredElements=Array.filter(elements,function(elem){if(strTagName==null||strTagName=="*"){return true
}if(elem.nodeName==null){return false
}return elem.nodeName.toUpperCase()==strTagName.toUpperCase()
})
}else{if(elements!=null){if(filteredElements==null){filteredElements=[]
}for(var i=0;
i<elements.length;
i++){var elem=elements[i];
if(elem.nodeName.toUpperCase()==strTagName.toUpperCase()){filteredElements.push(elem)
}}}}if(filteredElements==null||filteredElements.length==0){return filteredElements
}if(bReturnWhenOneElementFound){return[filteredElements[0]]
}return filteredElements
}var arrElements=(strTagName=="*"&&oElm.all)?oElm.all:oElm.getElementsByTagName(strTagName);
var arrReturnElements=[];
strClassName=strClassName.replace(/\-/g,"\\-");
var oRegExp=new RegExp("(^|\\s)"+strClassName+"(\\s|$)");
var oElement;
for(var i=0;
i<arrElements.length;
i++){oElement=arrElements[i];
if(oRegExp.test(oElement.className)){arrReturnElements.push(oElement);
if(bReturnWhenOneElementFound){break
}}}return arrReturnElements
};
WGGHtmlUtils.getFirstElementByClassName=function(oElm,strTagName,strClassName){var elements=WGGHtmlUtils.getElementsByClassName(oElm,strTagName,strClassName);
if(elements==null){return null
}if(elements.length==0){return null
}return elements[0]
};
WGGHtmlUtils.getParentFromPath=function(path){if(path==null){return null
}var parentPath=path;
var requestStringPos=parentPath.indexOf("?");
if(requestStringPos!=-1){parentPath=parentPath.substring(0,requestStringPos)
}var lastSlashPos=parentPath.lastIndexOf("/");
if(lastSlashPos==-1){return parentPath
}return parentPath.substring(0,lastSlashPos)
};
WGGHtmlUtils.readCookie=function(doc,cookieName){if(!doc){doc=document
}var cookie=doc.cookie.concat("");
var cookieValue=null;
while(cookie.length>0){var pos=cookie.indexOf("=");
if(pos==-1){break
}var theCookieName=WGGStringUtils.trim(cookie.substring(0,pos));
var sep=cookie.indexOf(";");
if(sep==-1){sep=cookie.length
}theCookieValue=cookie.substring(pos+1,sep);
if(theCookieName==cookieName){cookieValue=theCookieValue;
break
}cookie=cookie.substring(sep+1)
}return cookieValue
};
WGGHtmlUtils.writeCookie=function(doc,cookieName,cookieValue,seconds){if(!doc){doc=document
}if(!cookieName){return
}if(typeof cookieValue=="undefined"){return
}if(cookieValue==null){return
}if(!seconds){seconds=4*3600
}var date=new Date();
var time=date.getTime();
var millis=((seconds+3600)*1000);
time+=millis;
var expirationDate=new Date(time);
doc.cookie=cookieName+"="+cookieValue+"; expires="+expirationDate.toGMTString()+";"
};
WGGHtmlUtils.deleteCookie=function(doc,cookieName){if(!doc){doc=document
}if(!cookieName){return
}doc.cookie=name+"=;expires=Thu, 01-Jan-1970 00:00:01 GMT"
};
function WGGHttpRequestSerializerFactory(){}WGGHttpRequestSerializerFactory.createStandardGETRequestSerializer=function(){return new WGGHttpRequestSerializerFactory.StandardGETRequestSerializer()
};
WGGHttpRequestSerializerFactory.createStandardPOSTRequestSerializer=function(){return new WGGHttpRequestSerializerFactory.StandardPOSTRequestSerializer()
};
WGGHttpRequestSerializerFactory.StandardGETRequestSerializer=function(){};
WGGHttpRequestSerializerFactory.StandardGETRequestSerializer.prototype.serialize=function(protocol,host,port,path,paramsHashMap){var protocolStr=(protocol==null)?"http":protocol;
protocolStr+="://";
var theRequest="";
if(host==null){host="localhost"
}if(host.indexOf(protocolStr)==0){theRequest=host
}else{theRequest+=protocolStr;
theRequest+=host;
theRequest+=(port!=null&&port>=0&&port<=65535)?(":"+port):""
}if(path!=null){if(path.indexOf("/")!=0){theRequest+="/"
}theRequest+=path
}if(paramsHashMap!=null&&WGGDataTypeUtils.instanceOf(paramsHashMap,WGGHashMap)){var keyIterator=paramsHashMap.keyIterator();
var i=0;
while(keyIterator.hasNext()){theRequest+=(i==0)?"?":"&";
var key=keyIterator.next();
theRequest+=key+"="+encodeURIComponent(paramsHashMap.get(key));
i++
}}return{requestURL:theRequest,requestBody:null}
};
WGGHttpRequestSerializerFactory.StandardGETRequestSerializer.prototype.deserialize=function(requestURL,requestBody){function getRegExp(){return new RegExp("^(http|https|[a-z]+):\\/\\/(([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)|([_a-zA-Z0-9]+))?((:)([0-9]+))?([^\\?]*)?(\\?.*)?","g")
}var matches=getRegExp().exec(requestURL);
if(!matches){return null
}var protocol=matches[1];
var host=matches[2]||null;
var port=matches[7]||null;
if(port!=null&&port>=0&&port<=65535){port=parseInt(port)
}var path=matches[8]||null;
var query=matches[9]||null;
var paramsHashMap=null;
if(query){var pos=query.indexOf("?");
if(pos==0&&query.length>1){query=query.substr(1)
}var pieces=query.split("&");
if(pieces){paramsHashMap=new WGGHashMap();
for(var i=0;
i<pieces.length;
i++){var piece=pieces[i];
var nameValueSep=piece.indexOf("=");
if(nameValueSep!=-1){var name=piece.substr(0,nameValueSep);
var value=decodeURIComponent((nameValueSep+1<piece.length)?piece.substr(nameValueSep+1):"");
paramsHashMap.put(name,value)
}}}}return{protocol:protocol,host:host,port:port,path:path,paramsHashMap:paramsHashMap}
};
WGGHttpRequestSerializerFactory.StandardPOSTRequestSerializer=function(){this.getRequestSerializer=new WGGHttpRequestSerializerFactory.StandardGETRequestSerializer()
};
WGGHttpRequestSerializerFactory.StandardPOSTRequestSerializer.prototype.serialize=function(protocol,host,port,path,paramsHashMap){var theRequest=this.getRequestSerializer.serialize(protocol,host,port,path,paramsHashMap);
var requestURL=theRequest.requestURL;
var requestBody=null;
if(requestURL.indexOf("?")){var pieces=requestURL.split("?");
requestURL=pieces[0];
requestBody=pieces[1]
}return{requestURL:requestURL,requestBody:requestBody}
};
WGGHttpRequestSerializerFactory.StandardPOSTRequestSerializer.prototype.deserialize=function(requestURL,requestBody){var str=requestURL;
if(requestBody!=null){if(requestBody.indexOf("?")==-1){str+="?"
}str+=requestBody
}return this.getRequestSerializer.deserialize(str)
};
function WGGIterator(){}WGGIterator.prototype.hasNext=function(){};
WGGIterator.prototype.next=function(){};
Function.prototype.__wggClosure=function(obj){if(!window.__objs){window.__objs=[];
window.__funs=[]
}var fun=this;
var objId=obj.__objId;
if(!objId){__objs[objId=obj.__objId=__objs.length]=obj
}var funId=fun.__funId;
if(!funId){__funs[funId=fun.__funId=__funs.length]=fun
}if(!obj.__closures){obj.__closures=[]
}var closure=obj.__closures[funId];
if(closure){return closure
}obj=null;
fun=null;
return __objs[objId].__closures[funId]=function(){return __funs[funId].apply(__objs[objId],arguments)
}
};
function WGGListIterator(){var self=JSINER.extend(this,"WGGIterator");
self.array=null;
self.index=-1;
return self
}WGGListIterator.prototype.setInternalArray=function(array){if(!WGGDataTypeUtils.isArray(array)){return
}this.array=array
};
WGGListIterator.prototype.hasNext=function(){if(!WGGDataTypeUtils.isArray(this.array)){return false
}if(this.array==null){return false
}if(this.array.length==0){return false
}if(this.index>=this.array.length-1){return false
}return true
};
WGGListIterator.prototype.hasPrevious=function(){if(!WGGDataTypeUtils.isArray(this.array)){return false
}if(this.array==null){return false
}if(this.array.length==0){return false
}if(this.index<=0){return false
}return true
};
WGGListIterator.prototype.next=function(){if(!WGGDataTypeUtils.isArray(this.array)){return null
}var tmpIndex=(this.index==-1)?0:(this.index+1);
if(tmpIndex<0||tmpIndex>(this.array.length-1)){return null
}this.index=tmpIndex;
return this.array[this.index]
};
WGGListIterator.prototype.previous=function(){if(!WGGDataTypeUtils.isArray(this.array)){return null
}var tmpIndex=(this.index==-1)?0:(this.index-1);
if(tmpIndex<0||tmpIndex>(this.array.length-1)){return null
}this.index=tmpIndex;
return this.array[this.index]
};
WGGListIterator.prototype.current=function(){if(!WGGDataTypeUtils.isArray(this.array)){return null
}var tmpIndex=(this.index==-1)?0:this.index;
if(tmpIndex<0||tmpIndex>(this.array.length-1)){return null
}return this.array[tmpIndex]
};
WGGListIterator.prototype.reset=function(){this.index=-1
};
WGGListIterator.prototype.goLast=function(){if(!WGGDataTypeUtils.isArray(this.array)){return
}if(this.array==null){return
}if(this.array.length==0){return
}this.index=this.array.length
};
WGGListIterator.prototype.finalize=function(){if(this.array==null){return 0
}if(this.array.length==0){return 0
}var finalizedCount=0;
for(var i=this.array.length-1;
i>=0;
i--){var el=this.array.pop();
el=null;
finalizedCount++
}this.index=0;
return finalizedCount
};
function WGGNumberRangeIterator(minimum,maximum,stepSize){var self=JSINER.extend(this,"WGGIterator");
if(minimum>maximum){return
}if(stepSize<0){return
}if((maximum-minimum)%stepSize!=0){return
}self.minimum=minimum;
self.maximum=maximum;
self.stepSize=stepSize;
self.bInitialized=true;
self.value=null;
return self
}WGGNumberRangeIterator.prototype.hasNext=function(){if(!this.bInitialized){return false
}if(this.value>=this.maximum){return false
}return true
};
WGGNumberRangeIterator.prototype.hasPrevious=function(){if(!this.bInitialized){return false
}if(this.value<=this.minimum){return false
}return true
};
WGGNumberRangeIterator.prototype.next=function(){var tmpValue=(this.value==null)?this.minimum:(this.value+this.stepSize);
if(tmpValue<0||tmpValue>this.maximum){return null
}this.value=tmpValue;
return this.value
};
WGGNumberRangeIterator.prototype.previous=function(){var tmpValue=(this.value==null)?this.minimum:(this.value-this.stepSize);
if(tmpValue<0||tmpValue>this.maximum){return null
}this.value=tmpValue;
return this.value
};
WGGNumberRangeIterator.prototype.current=function(){return this.value
};
WGGNumberRangeIterator.prototype.setValue=function(value){if(!DataTypeUtils.isNumeric(value)){return
}if(!(value>=this.minimum&&value<=this.maximum)){return
}if(this.value%this.stepSize!=0){return
}this.value=value
};
WGGNumberRangeIterator.prototype.reset=function(){this.value=this.minimum
};
function WGGNumberValidator(){}WGGNumberValidator.isNumeric=function(value,validationString){if(validationString==null||validationString==""){validationString="0123456789."
}for(var i=0;
i<value.length;
i++){var ch=value.charAt(i);
if(validationString.indexOf(ch)==-1){return false
}}return true
};
function WGGObjectRepository(){this.hashMap=new WGGHashMap()
}WGGObjectRepository.prototype.writeObject=function(obj){if(obj==null){return
}if(!obj[WGGObjectRepository.KEY_IDENTIFIER]){throw new Error("the object to be written into the repository (WGGObjectRepository) does not contain an attribute "+WGGObjectRepository.KEY_IDENTIFIER)
}this.hashMap.put(obj[WGGObjectRepository.KEY_IDENTIFIER],obj)
};
WGGObjectRepository.prototype.readObject=function(identifier,bWithoutMetaData){if(identifier==null){return null
}var obj=this.hashMap.get(identifier);
var copy={};
WGGDataTypeUtils.extend(obj,copy);
if(bWithoutMetaData===true&&copy){delete copy._identifier
}return copy
};
WGGObjectRepository.prototype.removeObject=function(identifier){if(identifier==null){return false
}var obj=this.hashMap.remove(identifier);
return(obj!=null)
};
WGGObjectRepository.prototype.toJSON=function(){var iterator=this.hashMap.keyIterator();
var json={};
while(iterator.hasNext()){var key=iterator.next();
var value=this.readObject(key,false);
json[key]=value
}return json
};
WGGObjectRepository.prototype.fromJSON=function(json){if(!json){return
}for(var key in json){this.writeObject(json[key])
}};
WGGObjectRepository.prototype.finalize=function(){if(this.hashMap==null){return 0
}var finalizedCount=this.hashMap.finalize();
this.hashMap=null;
return ++finalizedCount
};
WGGObjectRepository.KEY_IDENTIFIER="_identifier";
function WGGObserver(){}WGGObserver.prototype.canHandleNotification=function(notification){return true
};
WGGObserver.prototype.getNotificationActionArgIndex=function(){return 1
};
WGGObserver.prototype.update=function(){return
};
WGGObserver.prototype.removeFromRegisteringSubjects=function(){if(typeof this.__registeringSubjects=="undefined"){return 0
}if(!WGGDataTypeUtils.isArray(this.__registeringSubjects)){return 0
}var count=0;
var i=0;
var max=this.__registeringSubjects.length;
while(i<max){var registeringSubject=this.__registeringSubjects[this.__registeringSubjects.length-1];
if(!registeringSubject.removeObserver){i++;
continue
}var bRemoved=registeringSubject.removeObserver(this);
if(bRemoved){count++;
WGGAbstractDebugInterface.gDebugInterface.info("registeringSubject removed on position "+i)
}else{WGGAbstractDebugInterface.gDebugInterface.error("registeringSubject not found:"+i);
throw new Error("observer not found!")
}i++
}return count
};
WGGObserver.prototype.observerRemoved=function(subject){if(typeof this.__registeringSubjects=="undefined"){return
}if(!WGGDataTypeUtils.isArray(this.__registeringSubjects)){return
}var k=0;
for(var i=0;
i<this.__registeringSubjects.length;
i++){var registeringSubject=this.__registeringSubjects[i];
if(registeringSubject==subject){k=i;
break
}}WGGAbstractDebugInterface.gDebugInterface.info("observerRemoved callback invoked for registeringSubject on position "+k);
if(k==0){var s=this.__registeringSubjects.shift();
s=null
}else{if(k==this.__registeringSubjects.length-1){var s=this.__registeringSubjects.pop();
s=null
}else{var part1=this.__registeringSubjects.slice(0,k);
var part2=this.__registeringSubjects.slice(k+1);
var s=this.__registeringSubjects[k];
s=null;
this.__registeringSubjects=part1.concat(part2)
}}};
WGGObserver.prototype.finalize=function(){return WGGFinalizer.finalize(this)
};
function WGGPerformanceProtocol(){this.history=[];
this.lastEntry=null
}WGGPerformanceProtocol.prototype.perform=function(o,f,args,benchmarks,gPerformanceProtocol){if(!WGGDataTypeUtils.isFunction(f)){return
}var modifiedFunctionBody="";
var functionBody=f.toString();
if(benchmarks!=null){var codeLines=functionBody.split("\n");
for(var i=0;
i<codeLines.length;
i++){var codeLine=codeLines[i];
var bFound=false;
for(var j=0;
j<benchmarks.length;
j++){var benchmarkName=WGGStringUtils.trim(codeLine);
var pos=benchmarkName.indexOf(benchmarks[j]);
if(pos==0){modifiedFunctionBody+=gPerformanceProtocol+".start( '"+benchmarkName+"' );\r\n";
modifiedFunctionBody+=codeLine+"\r\n";
modifiedFunctionBody+=gPerformanceProtocol+".end();\r\n";
bFound=true
}}if(!bFound){modifiedFunctionBody+=codeLine+"\r\n"
}}var fNameElements=modifiedFunctionBody.split(/ /g);
var fName=fNameElements[1].substring(0,fNameElements[1].indexOf("("));
if(fName==null||fName.length==0){fName="__anonymous"
}modifiedFunctionBody=modifiedFunctionBody.replace(/^function.*\(.*\)(\s)*\{/gm,"");
var trailingBracket=modifiedFunctionBody.lastIndexOf("}");
if(trailingBracket!=-1){modifiedFunctionBody=modifiedFunctionBody.substring(0,trailingBracket)
}var _f=new Function("",modifiedFunctionBody);
eval(gPerformanceProtocol+".start( '"+fName+"')");
_f.call(o,args);
eval(gPerformanceProtocol+".end( '"+fName+"')")
}else{f.call(o,args)
}};
WGGPerformanceProtocol.prototype.start=function(name){var s=new Date().getTime();
var entry=new WGGPerformanceProtocol.Entry(name,s,-1);
if(this.lastEntry==null){this.history.push(entry)
}else{this.lastEntry.entries.push(entry)
}entry.parent=this.lastEntry;
this.lastEntry=entry
};
WGGPerformanceProtocol.prototype.end=function(){this.lastEntry.end=new Date().getTime();
this.lastEntry=this.lastEntry.parent
};
WGGPerformanceProtocol.prototype.clear=function(){while(this.history.length>0){this.history.pop()
}this.history=[];
this.lastEntry=null
};
WGGPerformanceProtocol.prototype.toString=function(){var str="";
for(var i=0;
i<this.history.length;
i++){str+=this.history[i].toString()
}return str
};
WGGPerformanceProtocol.Entry=function(name,start,end){this.name=name;
this.start=start;
this.end=end;
this.entries=[];
this.parent=null
};
WGGPerformanceProtocol.Entry.prototype.hasEntries=function(){return(this.entries.length>0)
};
WGGPerformanceProtocol.Entry.prototype.addEntry=function(entry){this.entries.push(entry)
};
WGGPerformanceProtocol.Entry.prototype.isComplete=function(){return(this.end!=-1&&this.end>=this.start)
};
WGGPerformanceProtocol.Entry.prototype._toString=function(lvl,ch){var str="";
for(var i=0;
i<lvl;
i++){str+=ch
}str+=this.name+"|"+this.start+"|"+this.end+"|"+(this.end-this.start)+"|";
str+=(this.parent!=null)?this.parent.name:null;
str+="\r\n";
for(var i=0;
i<this.entries.length;
i++){var entry=this.entries[i];
str+=entry._toString(lvl+1,ch)
}return str
};
WGGPerformanceProtocol.Entry.prototype.toString=function(){return this._toString(0,".")
};
function WGGQueue(){this.arr=[]
}WGGQueue.prototype.put=function(element){if(element==null){return
}this.arr[this.arr.length-1]=element
};
WGGQueue.prototype.putAll=function(){if(this.isEmpty()){this.arr=[]
}this.arr=this.arr.concat.apply(this.arr,arguments)
};
WGGQueue.prototype.pull=function(){if(this.arr==null){return null
}if(this.arr.length==0){return null
}return this.arr.shift()
};
WGGQueue.prototype.peek=function(){if(this.isEmpty()){return null
}return this.arr[0]
};
WGGQueue.prototype.isEmpty=function(){return(this.arr==null||this.arr.length==0)
};
WGGQueue.prototype.size=function(){if(this.isEmpty()){return 0
}return this.arr.length
};
WGGQueue.prototype.finalize=function(){if(this.arr==null){return 0
}var finalizedCount=0;
while(this.arr.length>0){var el=this.arr.pop();
if(el==null){continue
}if(typeof el.finalize=="function"){finalizedCount+=el.finalize()
}el=null
}return finalizedCount
};
function WGGRectangle(x,y,width,height){if(!WGGDataTypeUtils.isNumber(x)){return
}if(!WGGDataTypeUtils.isNumber(y)){return
}if(!WGGDataTypeUtils.isNumber(width)){return
}if(!WGGDataTypeUtils.isNumber(height)){return
}this.x=x;
this.y=y;
this.width=(width>0)?width:0;
this.height=(height>0)?height:0
}WGGRectangle.prototype.add=function(x,y){var minx=this.x;
var maxx=this.x+width;
var miny=this.y;
var maxy=this.y+height;
if(x<minx){this.x=x
}if(x>maxx){this.width=x-minx
}if(y<miny){this.y=y
}if(y>maxy){this.height=y-miny
}};
WGGRectangle.prototype.contains=function(x,y){var minx=this.x;
var maxx=this.x+width;
var miny=this.y;
var maxy=this.y+height;
return(x>minx&&x<maxx&&y>miny&&y<maxy)
};
WGGRectangle.prototype.equals=function(rectangle){if(rectangle==null){return false
}return(this.x==rectangle.x&&this.y==rectangle.y&&this.width==rectangle.width&&this.height==rectangle.height)
};
WGGRectangle.prototype.intersects=function(rectangle){if(rectangle==null){return false
}var tw=this.width;
var th=this.height;
var rw=rectangle.width;
var rh=rectangle.height;
if(rw<=0||rh<=0||tw<=0||th<=0){return false
}var tx=this.x;
var ty=this.y;
var rx=rectangle.x;
var ry=rectangle.y;
rw+=rx;
rh+=ry;
tw+=tx;
th+=ty;
return((rw<rx||rw>tx)&&(rh<ry||rh>ty)&&(tw<tx||tw>rx)&&(th<ty||th>ry))
};
WGGRectangle.prototype.overlaps=function(rectangle){var intersection=this.intersection(rectangle);
if(intersection==null){return false
}return(intersection.area()>0)
};
WGGRectangle.prototype.intersectsInXDimension=function(rect){if(rect==null){return false
}return(rect.x>=this.x&&rect.x<=(this.x+this.width))
};
WGGRectangle.prototype.intersectsInYDimension=function(rect){if(rect==null){return false
}return((rect.y>=this.y&&rect.y<=(this.y+this.height))||(this.y>=rect.y&&this.y<=(rect.y+rect.height)))
};
WGGRectangle.prototype.setLocation=function(x,y){if(!WGGDataTypeUtils.isNumber(x)){return
}if(!WGGDataTypeUtils.isNumber(y)){return
}this.x=x;
this.y=y
};
WGGRectangle.prototype.setSize=function(width,height){if(!WGGDataTypeUtils.isNumber(width)){return
}if(!WGGDataTypeUtils.isNumber(height)){return
}this.width=width;
this.height=height
};
WGGRectangle.prototype.area=function(){return this.width*this.height
};
WGGRectangle.prototype.toString=function(){return"[x="+this.x+",y="+this.y+",width="+this.width+",height="+this.height+"]"
};
WGGRectangle.prototype.intersection=function(r){var tx1=this.x;
var ty1=this.y;
var rx1=r.x;
var ry1=r.y;
var tx2=tx1;
tx2+=this.width;
var ty2=ty1;
ty2+=this.height;
var rx2=rx1;
rx2+=r.width;
var ry2=ry1;
ry2+=r.height;
if(tx1<rx1){tx1=rx1
}if(ty1<ry1){ty1=ry1
}if(tx2>rx2){tx2=rx2
}if(ty2>ry2){ty2=ry2
}tx2-=tx1;
ty2-=ty1;
if(tx2<-2147483648){tx2=-2147483648
}if(ty2<-2147483648){ty2=-2147483648
}return new WGGRectangle(tx1,ty1,tx2,ty2)
};
WGGRectangle.prototype.union=function(r){var x1=Math.min(this.x,r.x);
var x2=Math.max(this.x+this.width,r.x+r.width);
var y1=Math.min(this.y,r.y);
var y2=Math.max(this.y+this.height,r.y+r.height);
return new WGGRectangle(x1,y1,x2-x1,y2-y1)
};
WGGRectangle.prototype.containsRect=function(X,Y,W,H){var w=this.width;
var h=this.height;
if((w|h|W|H)<0){return false
}var x=this.x;
var y=this.y;
if(X<x||Y<y){return false
}w+=x;
W+=X;
if(W<=X){if(w>=x||W>w){return false
}}else{if(w>=x&&W>w){return false
}}h+=y;
H+=Y;
if(H<=Y){if(h>=y||H>h){return false
}}else{if(h>=y&&H>h){return false
}}return true
};
function WGGSerializable(){}WGGSerializable.prototype.serialize=function(){return null
};
WGGSerializable.prototype.deserialize=function(obj){};
function WGGServerRequest(url,ajaxLoader){var self=JSINER.extend(this,"WGGSubject");
self=JSINER.extend(self,"WGGObserver");
this.id="req_"+new Date().getMilliseconds();
self.url=url;
self.ajaxLoader=null;
self.observers=[];
self.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){self.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){self.debugInterface=new WGGNullDebugInterface()
}self.debugInterface.debug(self);
self.setAjaxLoader(ajaxLoader);
if(self.ajaxLoader!=null){ajaxLoader.initialize()
}self.paramsHashMap=new WGGHashMap();
return self
}WGGServerRequest.prototype.setAjaxLoader=function(ajaxLoader){if(ajaxLoader!=null){if(WGGDataTypeUtils.instanceOf(ajaxLoader,WGGAjaxLoader)){this.ajaxLoader=ajaxLoader;
ajaxLoader.addObserver(this)
}}};
WGGServerRequest.prototype.addParam=function(paramName,paramValue){if(paramName!=null){this.paramsHashMap.put(paramName,paramValue)
}};
WGGServerRequest.prototype.addParams=function(params){if(params==null){return
}for(var paramName in params){this.paramsHashMap.put(paramName,params[paramName])
}};
WGGServerRequest.prototype.removeParam=function(paramName){if(paramName!=null){this.paramsHashMap.remove(paramName)
}};
WGGServerRequest.prototype.removeParams=function(){this.paramsHashMap.clear()
};
WGGServerRequest.prototype.send=function(){this.debugInterface.debug("WGGServerRequest.send");
if(this.url==null){throw"this.url of WGGServerRequest object must not be null"
}var serializer=(arguments.length>0)?arguments[0]:null;
if(serializer==null||!WGGDataTypeUtils.isObject(serializer)){serializer=WGGHttpRequestSerializerFactory.createStandardGETRequestSerializer()
}var protocol=location.protocol;
var pos=protocol.indexOf(":");
if(pos!=-1){protocol=protocol.substring(0,pos)
}var theRequest=serializer.serialize(protocol,this.url,null,null,this.paramsHashMap);
this.debugInterface.debug("request:");
this.debugInterface.info(theRequest.requestURL+(theRequest.requestBody?("?"+theRequest.requestBody):""));
var bAsync=true;
if(arguments.length>1){bAsync=arguments[1]
}this.ajaxLoader.sendRequest(theRequest.requestURL,theRequest.requestBody,null,bAsync)
};
WGGServerRequest.prototype.update=function(){this.debugInterface.warn("WGGServerRequest.update called (should be overwritten)")
};
WGGServerRequest.prototype.onUpdate=function(){};
WGGServerRequest.prototype.finalize=function(){if(this.url==null){return 0
}var finalizedCount=this.ajaxLoader.finalize();
this.ajaxLoader=null;
finalizedCount++;
finalizedCount+=this.removeObservers();
this.observers=null;
finalizedCount++;
finalizedCount+=this.paramsHashMap.finalize();
this.paramsHashMap=null;
finalizedCount++;
WGGFinalizer.destroyWggClosuresByObject(this);
this.url=null;
finalizedCount++;
return finalizedCount
};
function WGGServerRequestQueue(callbackObject,callbackMethod,callbackParams){var self=JSINER.extend(this,"WGGObserver");
self.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){self.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){self.debugInterface=new WGGNullDebugInterface()
}self.serverRequests=new Array();
self.callbackObject=callbackObject;
self.callbackMethod=callbackMethod;
self.callbackParams=callbackParams;
return self
}WGGServerRequestQueue.prototype.setCallbackObject=function(callbackObject){if(callbackObject==null){throw"passed parameter callbackObject is not a Object"
}this.callbackObject=callbackObject
};
WGGServerRequestQueue.prototype.setCallbackMethod=function(callbackMethod){if(!WGGDataTypeUtils.isFunction(callbackMethod)){throw"passed parameter callbackMethod is not a Function"
}this.callbackMethod=callbackMethod
};
WGGServerRequestQueue.prototype.addServerRequest=function(serverRequest){if(serverRequest==null){throw"serverRequest parameter must not be null"
}if(!serverRequest.addObserver){throw"MethodNotFound: method addObserver does not exist"
}if(!serverRequest.send){throw"MethodNotFound: method send does not exist"
}this.serverRequests.push(serverRequest);
serverRequest.addObserver(this)
};
WGGServerRequestQueue.prototype.update=function(){this.debugInterface.debug("WGGServerRequestQueue.update");
if(arguments==null){return
}var arg=(arguments.length>0)?arguments[0]:null;
if(this.serverRequests.length==0){this.callbackMethod.call(this.callbackObject,arg,this.callbackParams);
return
}var serverRequest=this.serverRequests.shift();
this.debugInterface.debug("got the next element from the queue with url: "+serverRequest.url);
for(var attrName in arg){serverRequest.addParam(attrName,arg[attrName])
}serverRequest.send()
};
WGGServerRequestQueue.prototype.start=function(){this.debugInterface.debug("WGGServerRequestQueue.start");
if(this.serverRequests==null){return
}var serverRequest=this.serverRequests.shift();
serverRequest.send()
};
WGGServerRequestQueue.prototype.finalize=function(){return WGGFinalizer.finalize(this)
};
function WGGSimpleTemplate(){this.emptyTemplate=(arguments.length>0)?arguments[0]:null;
this.bAutoReset=(arguments.length>1)?arguments[1]:null;
this.placeholderArray=[];
this.placeholderNumberedIterator=null;
this.compile()
}WGGSimpleTemplate.prototype.compile=function(){for(var i=0;
i<WGGSimpleTemplate.PlaceholderTypesEnum.PLACEHOLDER_TYPES.length;
i++){var placeholderType=WGGSimpleTemplate.PlaceholderTypesEnum.PLACEHOLDER_TYPES[i];
var patternStr=placeholderType.patternStr;
var pattern=placeholderType.pattern;
var resultMatcher=null;
while((resultMatcher=pattern.exec(this.emptyTemplate))!=null){var match=resultMatcher[0];
var startPosition=resultMatcher.index;
var placeholderDefinition=this.emptyTemplate.substring(startPosition,startPosition+match.length);
var placeholder=WGGSimpleTemplate.createPlaceholder(placeholderDefinition,startPosition,placeholderType,this);
this.placeholderArray.push(placeholder)
}}};
WGGSimpleTemplate.prototype.createNumberedIterator=function(placeholders){var internalArray=[];
for(var i=0;
i<placeholders.length;
i++){var placeholder=placeholders[i];
internalArray[placeholder.getPriority()]=placeholder
}var internalArrayArr=new WGGArray(internalArray);
for(var i=0;
i<internalArrayArr.length();
i++){if(typeof internalArrayArr.get(i)=="undefined"){internalArrayArr.removeAt(i)
}}internalArray=internalArrayArr.getArray();
this.placeholderNumberedIterator=new WGGListIterator();
this.placeholderNumberedIterator.setInternalArray(internalArray)
};
WGGSimpleTemplate.prototype.getPlaceholders=function(placeholderType){var tmpPlaceholderArray=[];
for(var i=0;
i<this.placeholderArray.length;
i++){var currentPlaceholder=this.placeholderArray[i];
if(currentPlaceholder.placeholderType==placeholderType){tmpPlaceholderArray.push(currentPlaceholder)
}}return tmpPlaceholderArray
};
WGGSimpleTemplate.prototype.getPlaceholderByName=function(){var name=arguments[0];
if(!WGGDataTypeUtils.isString(name)){return null
}for(var i=0;
i<this.placeholderArray.length;
i++){var currentPlaceholder=this.placeholderArray[i];
if(currentPlaceholder.name==name){return currentPlaceholder
}}return null
};
WGGSimpleTemplate.prototype.hasEmptyPlaceholder=function(placeholderType){if(placeholderType==null){return false
}if(placeholderType==WGGSimpleTemplate.PlaceholderTypesEnum.ORDERED_PLACEHOLDER_TYPE){if(this.placeholderNumberedIterator==null){var placeholders=this.getPlaceholders(WGGSimpleTemplate.PlaceholderTypesEnum.ORDERED_PLACEHOLDER_TYPE);
this.createNumberedIterator(placeholders)
}return this.placeholderNumberedIterator.hasNext()
}else{if(placeholderType==WGGSimpleTemplate.PlaceholderTypesEnum.NAMED_PLACEHOLDER_TYPE){var placeholders=this.getPlaceholders(WGGSimpleTemplate.PlaceholderTypesEnum.NAMED_PLACEHOLDER_TYPE);
for(var i=0;
i<placeholders.length;
i++){var placeholder=placeholders[i];
if(placeholder.getValue()==null){return true
}}}}return false
};
WGGSimpleTemplate.prototype.hasEmptyPlaceholders=function(){return(this.hasEmptyPlaceholder(WGGSimpleTemplate.PlaceholderTypesEnum.ORDERED_PLACEHOLDER_TYPE)||this.hasEmptyPlaceholder(WGGSimpleTemplate.PlaceholderTypesEnum.NAMED_PLACEHOLDER_TYPE))
};
WGGSimpleTemplate.createPlaceholder=function(definition,position,placeholderType,template){if(placeholderType==WGGSimpleTemplate.PlaceholderTypesEnum.ORDERED_PLACEHOLDER_TYPE){return new WGGSimpleTemplate.OrderedPlaceholder(definition,position,placeholderType,template)
}else{if(placeholderType==WGGSimpleTemplate.PlaceholderTypesEnum.NAMED_PLACEHOLDER_TYPE){return new WGGSimpleTemplate.NamedPlaceholder(definition,position,placeholderType,template)
}}return null
};
WGGSimpleTemplate.prototype.getEmptyTemplate=function(){return this.emptyTemplate
};
WGGSimpleTemplate.prototype.setAutoReset=function(bAutoReset){this.bAutoReset=bAutoReset
};
WGGSimpleTemplate.prototype.isAutoReset=function(){return this.bAutoReset
};
WGGSimpleTemplate.prototype.reset=function(){this.resetPlaceholderType(WGGSimpleTemplate.PlaceholderTypesEnum.ORDERED_PLACEHOLDER_TYPE);
this.resetPlaceholderType(WGGSimpleTemplate.PlaceholderTypesEnum.NAMED_PLACEHOLDER_TYPE)
};
WGGSimpleTemplate.prototype.resetPlaceholderType=function(placeholderType){if(placeholderType==null){throw"placeholderType must not be null"
}var placeholders=null;
if(placeholderType==WGGSimpleTemplate.PlaceholderTypesEnum.ORDERED_PLACEHOLDER_TYPE){placeholders=this.getPlaceholders(WGGSimpleTemplate.PlaceholderTypesEnum.ORDERED_PLACEHOLDER_TYPE);
this.createNumberedIterator(placeholders)
}else{if(placeholderType==WGGSimpleTemplate.PlaceholderTypesEnum.NAMED_PLACEHOLDER_TYPE){placeholders=this.getPlaceholders(WGGSimpleTemplate.PlaceholderTypesEnum.NAMED_PLACEHOLDER_TYPE)
}}if(placeholders!=null){for(var i=0;
i<placeholders.length;
i++){placeholders[i].value=null
}}};
WGGSimpleTemplate.prototype.assign=function(){var placeholderValue=arguments[0];
var placeholderName=null;
var bFinal=false;
if(arguments.length==2){placeholderName=arguments[1]
}if(arguments.length==3){bFinal=arguments[2]
}if(this.bAutoReset){if(placeholderName==null){if(!this.hasEmptyPlaceholder(WGGSimpleTemplate.PlaceholderTypesEnum.ORDERED_PLACEHOLDER_TYPE)){this.reset(WGGSimpleTemplate.PlaceholderTypesEnum.ORDERED_PLACEHOLDER_TYPE)
}}else{if(!this.hasEmptyPlaceholder(WGGSimpleTemplate.PlaceholderTypesEnum.NAMED_PLACEHOLDER_TYPE)){this.reset(WGGSimpleTemplate.PlaceholderTypesEnum.NAMED_PLACEHOLDER_TYPE)
}}}else{if(placeholderName==null){if(!this.hasEmptyPlaceholder(WGGSimpleTemplate.PlaceholderTypesEnum.ORDERED_PLACEHOLDER_TYPE)){return false
}}else{if(!this.hasEmptyPlaceholder(WGGSimpleTemplate.PlaceholderTypesEnum.NAMED_PLACEHOLDER_TYPE)){return false
}}}if(placeholderName==null){if(this.placeholderNumberedIterator.hasNext()){var placeholder=this.placeholderNumberedIterator.next();
placeholder.setValue(placeholderValue,bFinal);
return true
}}else{for(var i=0;
i<this.placeholderArray.length;
i++){var placeholder=this.placeholderArray[i];
if(placeholderName==placeholder.getName()){if(placeholder.getValue()!=null){continue
}placeholder.setValue(placeholderValue,bFinal);
return true
}}}return false
};
WGGSimpleTemplate.prototype.getResult=function(){var sortedPlaceholders=[];
for(var i=0;
i<this.placeholderArray.length;
i++){var placeholder=this.placeholderArray[i];
sortedPlaceholders[placeholder.position]=placeholder
}var result="";
var j=0;
for(var i=0;
i<sortedPlaceholders.length;
i++){var placeholder=sortedPlaceholders[i];
if(placeholder==null){continue
}result+=this.emptyTemplate.substring(j,placeholder.position);
if(placeholder.value!=null){result+=placeholder.value
}else{result+=placeholder.getName()
}j=placeholder.position+placeholder.definition.length
}result+=this.emptyTemplate.substring(j,this.emptyTemplate.length);
for(var i=sortedPlaceholders.length-1;
i>=0;
i--){var el=sortedPlaceholders.pop();
el=null
}return result
};
WGGSimpleTemplate.prototype.finalize=function(){if(this.placeholderArray==null){return 0
}var finalizedCount=0;
for(var i=this.placeholderArray.length-1;
i>=0;
i--){var el=this.placeholderArray.pop();
finalizedCount+=el.finalize();
el=null
}if(this.placeholderNumberedIterator!=null){finalizedCount+=this.placeholderNumberedIterator.finalize()
}return finalizedCount
};
WGGSimpleTemplate.PLH_ORDERED=1;
WGGSimpleTemplate.PLH_NAMED=2;
WGGSimpleTemplate.LEADING_MARKER="\\{\\{";
WGGSimpleTemplate.TRAILING_MARKER="\\}\\}";
WGGSimpleTemplate.PlaceholderTypesEnum=function(type,patternStr){if(patternStr==null){throw"patternStr must not be null"
}if(type!=1&&type!=2){throw"type not valid"
}this.type=type;
this.patternStr=patternStr;
this.pattern=new RegExp(this.patternStr,"g")
};
WGGSimpleTemplate.PlaceholderTypesEnum.prototype.finalize=function(){return WGGFinalizer.finalize(this)
};
WGGSimpleTemplate.PlaceholderTypesEnum.ORDERED_PLACEHOLDER_TYPE=new WGGSimpleTemplate.PlaceholderTypesEnum(WGGSimpleTemplate.PLH_ORDERED,WGGSimpleTemplate.LEADING_MARKER+"[\\d]+"+WGGSimpleTemplate.TRAILING_MARKER);
WGGSimpleTemplate.PlaceholderTypesEnum.NAMED_PLACEHOLDER_TYPE=new WGGSimpleTemplate.PlaceholderTypesEnum(WGGSimpleTemplate.PLH_NAMED,WGGSimpleTemplate.LEADING_MARKER+"([a-zA-Z]+[\\w]*)"+WGGSimpleTemplate.TRAILING_MARKER);
WGGSimpleTemplate.PlaceholderTypesEnum.PLACEHOLDER_TYPES=[WGGSimpleTemplate.PlaceholderTypesEnum.ORDERED_PLACEHOLDER_TYPE,WGGSimpleTemplate.PlaceholderTypesEnum.NAMED_PLACEHOLDER_TYPE];
WGGSimpleTemplate.AbstractPlaceholder=function(definition,position,placeholderType,template){this.definition=null;
this.position=null;
this.placeholderType=null;
this.template=null;
this.name=null;
this.value=null;
this.bFinal=false;
this.initialize=function(definition,position,placeholderType,template){this.definition=definition;
this.position=position;
this.placeholderType=placeholderType;
this.template=template
}
};
WGGSimpleTemplate.AbstractPlaceholder.prototype.getValue=function(){return this.value
};
WGGSimpleTemplate.AbstractPlaceholder.prototype.setValue=function(){if(arguments.length==0){return
}var value=arguments[0];
var bFinal=false;
if(arguments.length==2){bFinal=arguments[1]
}if(!this.bFinal){this.value=value;
this.bFinal=bFinal
}};
WGGSimpleTemplate.AbstractPlaceholder.prototype.getName=function(){};
WGGSimpleTemplate.AbstractPlaceholder.prototype.finalize=function(){this.template=null;
this.placeholderType=null;
return 2
};
WGGSimpleTemplate.OrderedPlaceholder=function(definition,position,placeholderType,template){var self=JSINER.extend(this,WGGSimpleTemplate.AbstractPlaceholder);
if(definition!=null){self.initialize(definition,position,placeholderType,template)
}return self
};
WGGSimpleTemplate.OrderedPlaceholder.prototype.getPriority=function(){return parseInt(this.getName())
};
WGGSimpleTemplate.OrderedPlaceholder.prototype.getName=function(){if(this.name==null){var pattern=new RegExp("[\\d]+","g");
var resultMatcher=pattern.exec(this.definition);
if(resultMatcher){if(resultMatcher.length>0){this.name=resultMatcher[0]
}}}return this.name
};
WGGSimpleTemplate.NamedPlaceholder=function(definition,position,placeholderType,template){var self=JSINER.extend(this,WGGSimpleTemplate.AbstractPlaceholder);
if(definition!=null){self.initialize(definition,position,placeholderType,template)
}return self
};
WGGSimpleTemplate.NamedPlaceholder.prototype.getName=function(){if(this.name==null){var pattern=new RegExp("[a-zA-Z]+[\\w]*","g");
var resultMatcher=pattern.exec(this.definition);
if(resultMatcher){if(resultMatcher.length>0){this.name=resultMatcher[0]
}}}return this.name
};
function WGGStack(){this.arr=new WGGArray()
}WGGStack.prototype.push=function(element){if(element==null){return false
}this.arr.add(element);
return true
};
WGGStack.prototype.poll=function(){if(this.arr.length==0){return null
}return this.arr.removeAt(this.arr.length-1)
};
WGGStack.prototype.peek=function(){if(this.arr.length==0){return null
}return this.arr.get(this.arr.length-1)
};
function WGGStorable(){}WGGStorable.prototype.getStorableIdentifier=function(){};
WGGStorable.prototype.getState=function(){};
WGGStorable.prototype.setState=function(obj){};
WGGStorable.prototype.beforeLoadState=function(){};
WGGStorable.prototype.afterLoadState=function(){};
WGGStorable.prototype.loadState=function(repository){if(repository==null){return
}this.beforeLoadState();
var identifier=this.getStorableIdentifier();
var state=repository.readObject(identifier);
if(state!=null){delete state._identifier
}this.setState(state);
this.afterLoadState()
};
WGGStorable.prototype.storeState=function(repository){if(repository==null){return
}var identifier=this.getStorableIdentifier();
var state=this.getState();
if(state==null){return
}state._identifier=identifier;
repository.writeObject(state)
};
WGGStorable.prototype.removeState=function(repository){if(repository==null){return
}var identifier=this.getStorableIdentifier();
repository.removeObject(identifier)
};
function WGGStringUtils(){}WGGStringUtils.leftTrim=function(sString){if(sString==null){return null
}if(typeof sString.replace!="function"){return sString
}return sString.replace(/^\s+/,"")
};
WGGStringUtils.rightTrim=function(sString){if(sString==null){return null
}if(typeof sString.replace!="function"){return sString
}return sString.replace(/\s+$/,"")
};
WGGStringUtils.trim=function(sString){sString=WGGStringUtils.leftTrim(sString);
sString=WGGStringUtils.rightTrim(sString);
return sString
};
WGGStringUtils.ord=function(sString){if(sString==null){return 0
}if(sString==""){return 0
}return sString.charCodeAt(0)
};
WGGStringUtils.chr=function(charCode){if(charCode==null){return null
}return String.fromCharCode(charCode)
};
WGGStringUtils.escape=function(sString){var specialChars=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];
var regExp=new RegExp("(\\"+specials.join("|\\")+")","g");
return sString.replace(regExp,"\\$1")
};
WGGStringUtils.explode=function(delimiter,str,limit){if(str==null){return null
}if(delimiter==null){return[str]
}if(!WGGDataTypeUtils.isString(delimiter)){return null
}if(!WGGDataTypeUtils.isString(str)){return null
}var pieces=str.split(delimiter);
if(!limit){return pieces
}if(limit<0){if(limit*(-1)<=pieces.length){return pieces.slice(0,pieces.length-(limit*(-1)))
}}else{return pieces.slice(0,limit)
}return null
};
WGGStringUtils.implode=function(glue,pieces){if(pieces==null){return""
}if(glue==null){glue=""
}var str="";
for(var i=0;
i<pieces.length;
i++){if(i>0){str+=glue
}str+=pieces[i]
}return str
};
WGGStringUtils.leftPad=function(str,ch,length){if(typeof str!="string"){str=""+str
}while(str.length<length){str=ch+str
}return str
};
WGGStringUtils.rightPad=function(str,ch,length){if(typeof str!="string"){str=""+str
}while(str.length<length){str=str+ch
}return str
};
WGGStringUtils.hashCode=function(obj){var hash=0;
if(WGGDataTypeUtils.isString(obj)){for(var i=0;
i<obj.length;
i++){var ch=obj.charCodeAt(i);
hash=31*hash+ch
}}else{if(WGGDataTypeUtils.isArray(obj)){hash="";
for(var i=0;
i<obj.length;
i++){var el=obj[i];
hash+=WGGStringUtils.hashCode(el?el.toString():"null")
}}}return"h_"+hash.toString()
};
WGGStringUtils.CaseInsensitiveComparator=function(){var self=JSINER.extend(this,"WGGComparator");
self.compare=function(s1,s2){var n1=s1.length;
var n2=s2.length;
var min=Math.min(n1,n2);
for(var i=0;
i<min;
i++){var c1=s1.charAt(i);
var c2=s2.charAt(i);
if(c1!=c2){c1=c1.toUpperCase();
c2=c2.toUpperCase();
if(c1!=c2){c1=c1.toLowerCase();
c2=c2.toLowerCase();
if(c1!=c2){return s1.charCodeAt(i)-s2.charCodeAt(i)
}}}}return n1-n2
};
return self
};
WGGStringUtils.simpleSerialize=function(obj){if(obj==null){return obj
}if(WGGDataTypeUtils.isPrimitive(obj)){if(typeof obj=="string"){return'"'+obj+'"'
}else{return obj
}}if(typeof obj=="array"){var str="";
for(var i=0;
i<obj.length;
i++){if(str!=""){str+=","
}str+=obj[i]?WGGStringUtils.simpleSerialize(obj[i]):null
}return"["+str+"]"
}var str="";
for(var attr in obj){if(str!=""){str+=","
}str+='"'+attr+'" : ';
var val=obj[attr];
str+=val?WGGStringUtils.simpleSerialize(val):null
}return"{"+str+"}"
};
WGGStringUtils.LINE_SEP=String.fromCharCode(13)+String.fromCharCode(10);
function WGGSubject(){this.observers=[];
this.type=WGGField.getType(this)
}WGGSubject.prototype.notify=function(){var args=[];
for(var i=0;
i<arguments.length;
i++){args[i]=arguments[i]
}if(!this.observers){return
}var count=this.observers.length;
for(var i=0;
i<count;
i++){var observer=this.observers[i];
if(observer==null){continue
}if(typeof observer.canHandleNotification=="function"&&typeof observer.getNotificationActionArgIndex=="function"){var action=null;
if(observer.getNotificationActionArgIndex()<args.length){action=args[observer.getNotificationActionArgIndex()]
}if(!observer.canHandleNotification(action)){continue
}}observer.update.apply(observer,args);
if(WGGSubject.monitoringEnabled==true){var observerType=WGGField.getType(observer);
var bDoMonitor=true;
if(WGGSubject.monitoredTypesMap!=null){bDoMonitor=(WGGSubject.monitoredTypesMap[observerType]==true&&WGGSubject.monitoredTypesMap[this.type]==true)
}if(WGGSubject.excludedTokensMap!=null){for(var excludedToken in WGGSubject.excludedTokensMap){if(observerType.indexOf(excludedToken)!=-1||this.type.indexOf(excludedToken)!=-1){bDoMonitor=false
}for(var j=0;
j<args.length;
j++){if(args[j]==null){continue
}if(args[j].toString().indexOf(excludedToken)!=-1){bDoMonitor=false;
break
}}}}if(bDoMonitor==true){var notificationParamsStr="[";
for(var j=0;
j<args.length;
j++){if(j>0){notificationParamsStr+=",\\n"
}var arg=args[j];
if(arg!=null){if(!WGGDataTypeUtils.isPrimitive(arg)){var f=new WGGField(arg);
var t=f.getType();
if(t==null||t=="Object"){arg=("{"+WGGStringUtils.trim(f.getUndecoratedValue()+"}")||"null")
}else{arg=t
}}else{arg=arg.toString()
}if(arg.length>30){arg=arg.substring(0,30)+"..."
}arg=arg.replace(/\n/g,"").replace(/"/g,'\\"')
}notificationParamsStr+=j+":"+arg
}notificationParamsStr+="]";
var key=(this.type||"Unknown")+" -> "+(observerType||"Unknown");
var value='[ taillabel="['+WGGSubject.monitoringBuffer.length+']" label = "'+notificationParamsStr+'" ]';
var o={};
o[key]=value;
WGGSubject.monitoringBuffer.push(o)
}}}};
WGGSubject.prototype.addObserver=function(observer){if(observer==null){return false
}if(!observer.update){return false
}if(this.getObserver(observer)==null){this.observers.push(observer);
if(typeof observer.__registeringSubjects=="undefined"){observer.__registeringSubjects=[]
}observer.__registeringSubjects.push(this);
return true
}return false
};
WGGSubject.prototype.addObservers=function(observers){if(observers==null){return
}if(!WGGDataTypeUtils.isArray(observers)){return
}var bAtLeastOneRegistered=false;
for(var i=0;
i<observers.length;
i++){bRegistered=this.addObserver(observers[i]);
if(bRegistered==true){bAtLeastOneRegistered=bRegistered
}}return bAtLeastOneRegistered
};
WGGSubject.prototype.getObserver=function(observer){if(!observer.update){return null
}var count=this.observers.length;
for(var i=0;
i<count;
i++){if(this.observers[i]==observer){return observer
}}return null
};
WGGSubject.prototype.getObserverByProperty=function(propertyName,propertyValue){if(propertyName==null){return
}var count=this.observers.length;
for(var i=0;
i<count;
i++){var currentObserver=this.observers[i];
try{if(currentObserver[propertyName]==propertyValue){return currentObserver
}}catch(e){}}return null
};
WGGSubject.prototype.getObserversByClass=function(clazz){if(clazz==null){return this.observers
}var retVal=[];
var count=this.observers.length;
for(var i=0;
i<count;
i++){var currentObserver=this.observers[i];
try{if(WGGDataTypeUtils.instanceOf(currentObserver,clazz)){retVal.push(currentObserver)
}}catch(e){}}return retVal
};
WGGSubject.prototype.removeObserver=function(observer){var count=this.observers.length;
for(var i=0;
i<count;
i++){if(this.observers[i]==observer){switch(i){case 0:var o=this.observers.shift();
if(WGGDataTypeUtils.isFunction(o.observerRemoved)){o.observerRemoved(this)
}o=null;
WGGAbstractDebugInterface.gDebugInterface.info("observer removed on position 0");
break;
case (count-1):var o=this.observers.pop();
if(WGGDataTypeUtils.isFunction(o.observerRemoved)){o.observerRemoved(this)
}o=null;
WGGAbstractDebugInterface.gDebugInterface.info("observer removed at the end");
break;
default:var part1=this.observers.slice(0,i);
var part2=this.observers.slice(i+1);
var o=this.observers[i];
if(WGGDataTypeUtils.isFunction(o.observerRemoved)){o.observerRemoved(this)
}o=null;
WGGAbstractDebugInterface.gDebugInterface.info("observer removed on position "+i);
this.observers=part1.concat(part2);
break
}return true
}}return false
};
WGGSubject.prototype.removeObservers=function(){if(this.observers==null){return 0
}var count=0;
while(this.observers.length>0){var o=this.observers.pop();
if(WGGDataTypeUtils.isFunction(o.observerRemoved)){o.observerRemoved(this)
}o=null;
count++
}return count
};
WGGSubject.prototype.finalize=function(){var count=this.removeObservers();
this.type=null;
return ++count
};
WGGSubject.monitoringEnabled=false;
WGGSubject.monitoredTypesMap=null;
WGGSubject.excludedTokensMap=null;
WGGSubject.monitoringBuffer=[];
WGGSubject.getMonitoringResult=function(){var result="digraph notifications {\n";
result+="rankdir=LR;\n";
result+='node [shape=ellipse,width="1.3",peripheries=2,style="filled",color="grey0",fillcolor="azure2"];\n';
result+='graph [fontname = "Arial",fontsize=12];\n';
result+='edge  [fontname = "Arial",fontsize=8, fontcolor=black, arrowhead=normal, color=royalblue4, arrowsize=1.5, labelfontcolor="brown4", labelfontsize="12"];\n';
result+="ranksep = 1.5;\n";
result+="nodesep = .25;\n";
for(var i=0;
i<WGGSubject.monitoringBuffer.length;
i++){var monitoringBufferElement=WGGSubject.monitoringBuffer[i];
for(var e in monitoringBufferElement){result+=e+" "+monitoringBufferElement[e]+";\n"
}}result+="}";
return result
};
function WGGThread(){this.bExecuteOnce=(arguments.length>0)?WGGDataTypeUtils.toBoolean(arguments[0]):true;
if(!this.bExecuteOnce){this.fBreakCondition=(arguments.length>1&&WGGDataTypeUtils.isFunction(arguments[1]))?arguments[1]:null
}if((!this.bExecuteOnce)&&this.fBreakCondition==null){throw new Error("fBreakCondition must not be null (bExecuteOnce == false)")
}this.timeLag=(arguments.length>2)?parseInt(arguments[2]):10;
this.handle=null;
this.bStarted=false
}WGGThread.prototype.beforeStart=function(){};
WGGThread.prototype.afterStart=function(){};
WGGThread.prototype.beforeStop=function(){};
WGGThread.prototype.afterStop=function(){};
WGGThread.prototype.start=function(){if(this.handle!=null){return
}var f=(this.bExecuteOnce)?window.setTimeout:window.setInterval;
this.beforeStart();
WGGAbstractDebugInterface.gDebugInterface.info("start");
this.handle=f(function(){this.__run()
}.__wggClosure(this),this.timeLag);
this.bStarted=true;
this.afterStart()
};
WGGThread.prototype.__run=function(){WGGAbstractDebugInterface.gDebugInterface.debug("__run");
var bBreakConditionFullfilled=false;
if(this.fBreakCondition!=null){bBreakConditionFullfilled=this.fBreakCondition.apply(null,[])
}if(bBreakConditionFullfilled){WGGAbstractDebugInterface.gDebugInterface.info("condition fulfilled => stop thread");
this.beforeStop();
this.stop();
this.afterStop()
}else{this.run()
}};
WGGThread.prototype.run=function(){};
WGGThread.prototype.isRunning=function(){return(this.bStarted===true)
};
WGGThread.prototype.stop=function(){if(this.handle==null){return
}var f=(this.bExecuteOnce)?window.clearTimeout:window.clearInterval;
WGGAbstractDebugInterface.gDebugInterface.info("stop");
f(this.handle);
this.handle=null;
this.bStarted=false
};
WGGThread.prototype.finalize=function(){if(this.handle!=null){this.stop()
}WGGFinalizer.finalize(this)
};
function WGGVisitable(){}WGGVisitable.prototype.accept=function(visitor){if(visitor==null){return
}if(!WGGDataTypeUtils.isFunction(visitor.visit)){return
}visitor.visit(this)
};
function WGGVisitor(){}WGGVisitor.prototype.visit=function(visitable){};
function WGGXmlUtils(){}WGGXmlUtils.parseAttributes=function(node){var obj={};
var attrs=node.attributes;
if(!attrs){return null
}if(attrs.length==0){return null
}for(var i=0;
i<attrs.length;
i++){var attr=attrs[i];
obj[node.nodeName+"@"+attr.name]=attr.value
}return obj
};
WGGXmlUtils.parseChildNodes=function(node){var completeResultObj=new Object();
WGGDataTypeUtils.extend(WGGXmlUtils.parseAttributes(node),completeResultObj);
var childNodes=node.childNodes;
if(childNodes!=null){for(var i=0;
i<childNodes.length;
i++){var childNode=childNodes[i];
var nodeType=childNode.nodeType;
var theNodeName=null;
var theNodeValue=null;
switch(nodeType){case 1:case 9:var particularResultObj=null;
try{var firstChild=childNode.firstChild;
if(firstChild.nodeType==3){particularResultObj=firstChild.nodeValue
}else{throw"firstChild of the node "+childNode.nodeName+" may not be of the type 3"
}}catch(e){particularResultObj=WGGXmlUtils.parseChildNodes(childNode)
}theNodeName=childNode.nodeName;
theNodeValue=particularResultObj;
break;
case 3:theNodeName=childNode.parentNode.nodeName;
theNodeValue=childNode.nodeValue;
break
}var attributeValues=WGGXmlUtils.parseAttributes(childNode);
var complexNodeValue={};
if(attributeValues!=null){complexNodeValue["{value}"]=theNodeValue;
complexNodeValue=WGGDataTypeUtils.extend(attributeValues,complexNodeValue)
}else{complexNodeValue=theNodeValue
}if(completeResultObj[theNodeName]){if(!WGGDataTypeUtils.isArray(completeResultObj[theNodeName])){var tmpValue=completeResultObj[theNodeName];
completeResultObj[theNodeName]=[];
completeResultObj[theNodeName].push(tmpValue);
completeResultObj[theNodeName].push(complexNodeValue)
}else{completeResultObj[theNodeName].push(complexNodeValue)
}}else{completeResultObj[theNodeName]=complexNodeValue
}}}return completeResultObj
};
WGGXmlUtils.getChildValue=function(node){if(node==null){return null
}var nodeValue=null;
if(node.nodeValue){return node.nodeValue
}var childNodes=node.childNodes;
var value=null;
for(var i=0;
i<childNodes.length;
i++){var childNode=childNodes[i];
if(childNode.nodeType==3||childNode.nodeType==4){if(value==null){value=""
}value+=childNode.nodeValue
}}return value
};
WGGXmlUtils.createDOMParser=function(){if(typeof DOMParser=="undefined"){var WGGDOMParser=function(){};
WGGDOMParser.prototype.parseFromString=function(str,contentType){if(typeof ActiveXObject!="undefined"){var domDocument=new ActiveXObject("MSXML.DomDocument");
domDocument.async=false;
domDocument.loadXML(str);
return domDocument
}else{if(typeof XMLHttpRequest!="undefined"){var req=new XMLHttpRequest();
req.open("GET","data:"+(contentType||"application/xml")+";charset=utf-8,"+encodeURIComponent(str),false);
if(req.overrideMimeType){req.overrideMimeType(contentType)
}req.send(null);
return req.responseXML
}}};
return new WGGDOMParser()
}else{return new DOMParser()
}};
WGGXmlUtils.selectNodes=function(element,xPathExpression,namespaceResolver){if(element==null){return null
}if(typeof element.getElementsByTagName=="undefined"){return null
}var xmlDoc=element.ownerDocument;
if(xmlDoc==null){xmlDoc=element
}if(typeof XPathResult=="undefined"){var namespaceStr="";
if(namespaceResolver!=null){if(!namespaceResolver.possibleNamespaces){throw"namespaceResolver should define a static member possibleNamespaces { 'b' : 'http://www.backbase.com/2006/btl', ... }"
}for(var prefix in namespaceResolver.possibleNamespaces){if(namespaceStr!=""){namespaceStr+=" "
}namespaceStr+="xmlns:"+prefix+'="'+namespaceResolver.possibleNamespaces[prefix]+'"'
}}xmlDoc.setProperty("SelectionLanguage","XPath");
xmlDoc.setProperty("SelectionNamespaces",namespaceStr);
if(/^\/\/.+\[([0-9]+)\]$/g.exec(xPathExpression)){return element.selectSingleNode(xPathExpression)
}else{return element.selectNodes(xPathExpression)
}}else{if(element.documentElement){element=element.documentElement
}var xPathResult=xmlDoc.evaluate(xPathExpression,element,namespaceResolver,XPathResult.ANY_TYPE,null);
var resultArr=[];
var node=xPathResult.iterateNext();
var i=0;
while(node){resultArr[i]=node;
node=xPathResult.iterateNext();
i++
}return resultArr
}};
WGGXmlUtils.selectFirstNode=function(element,xPathExpression,namespaceResolver){var nodes=WGGXmlUtils.selectNodes(element,xPathExpression,namespaceResolver);
if(nodes==null){return null
}if(nodes.length==0){return null
}return nodes[0]
};
WGGXmlUtils.serialize=function(node){try{if(typeof XMLSerializer!="undefined"){var xmlSerializer=new XMLSerializer();
return xmlSerializer.serializeToString(node)
}else{if(node.xml){return node.xml
}else{throw"no serialization of XML supported"
}}}catch(e){throw e
}};
if(typeof OpenLayers!="undefined"){OpenLayers.Control.HorizontalPanZoomBar=OpenLayers.Class(OpenLayers.Control.PanZoom,{zoomStopWidth:18,zoomStopHeight:18,slider:null,sliderEvents:null,zoomBarDiv:null,divEvents:null,zoomWorldIcon:false,initialize:function(){OpenLayers.Control.PanZoom.prototype.initialize.apply(this,arguments)
},destroy:function(){this._removeZoomBar();
this.map.events.un({changebaselayer:this.redraw,scope:this});
OpenLayers.Control.PanZoom.prototype.destroy.apply(this,arguments)
},setMap:function(map){OpenLayers.Control.PanZoom.prototype.setMap.apply(this,arguments);
this.map.events.register("changebaselayer",this,this.redraw)
},redraw:function(){if(this.div!=null){this.removeButtons();
this._removeZoomBar()
}this.draw()
},draw:function(px){OpenLayers.Control.prototype.draw.apply(this,arguments);
px=this.position.clone();
this.buttons=[];
var sz=new OpenLayers.Size(18,18);
var centered=new OpenLayers.Pixel(px.x+sz.w/2,px.y);
var wposition=sz.w;
if(this.zoomWorldIcon){centered=new OpenLayers.Pixel(px.x+sz.w,px.y)
}this._addButton("panup","north-mini.png",centered,sz);
px.y=centered.y+sz.h;
this._addButton("panleft","west-mini.png",px,sz);
if(this.zoomWorldIcon){this._addButton("zoomworld","zoom-world-mini.png",px.add(sz.w,0),sz);
wposition*=2
}this._addButton("panright","east-mini.png",px.add(wposition,0),sz);
this._addButton("pandown","south-mini.png",centered.add(0,sz.h*2),sz);
var zoomMinusPos=new OpenLayers.Pixel(wposition+2*sz.w,centered.y+sz.h);
this._addButton("zoomout","zoom-minus-mini.png",zoomMinusPos,sz);
centered=this._addZoomBar(zoomMinusPos.add(sz.w,0));
var zoomPlusPos=centered;
this._addButton("zoomin","zoom-plus-mini.png",zoomPlusPos,sz);
return this.div
},_addZoomBar:function(centered){var imgLocation=OpenLayers.Util.getImagesLocation();
var id=this.id+"_"+this.map.id;
var zoomsToEnd=this.map.getNumZoomLevels()-1-this.map.getZoom();
var top=(navigator.userAgent.indexOf("MSIE")==-1)?-1:4;
var slider=OpenLayers.Util.createAlphaImageDiv(id,centered.add(zoomsToEnd*this.zoomStopWidth,top),new OpenLayers.Size(20,9),imgLocation+"slider.png","absolute");
this.slider=slider;
this.sliderEvents=new OpenLayers.Events(this,slider,null,true,{includeXY:true});
this.sliderEvents.on({mousedown:this.zoomBarDown,mousemove:this.zoomBarDrag,mouseup:this.zoomBarUp,dblclick:this.doubleClick,click:this.doubleClick});
var sz=new OpenLayers.Size();
sz.h=this.zoomStopHeight;
sz.w=this.zoomStopWidth*this.map.getNumZoomLevels();
var div=null;
if(OpenLayers.Util.alphaHack()){var id=this.id+"_"+this.map.id;
div=OpenLayers.Util.createAlphaImageDiv(id,centered,new OpenLayers.Size(sz.w,this.zoomStopHeight),imgLocation+"zoombar.png","absolute",null,"crop");
div.style.height=sz.h+"px"
}else{div=OpenLayers.Util.createDiv("OpenLayers_Control_HorizontalPanZoomBar_Zoombar"+this.map.id,centered,sz,imgLocation+"zoombar.png")
}this.zoombarDiv=div;
this.divEvents=new OpenLayers.Events(this,div,null,true,{includeXY:true});
this.divEvents.on({mousedown:this.divClick,mousemove:this.passEventToSlider,dblclick:this.doubleClick,click:this.doubleClick});
this.div.appendChild(div);
this.startLeft=parseInt(div.style.left);
this.div.appendChild(slider);
this.map.events.register("zoomend",this,this.moveZoomBar);
centered=centered.add(this.zoomStopWidth*this.map.getNumZoomLevels(),0);
return centered
},_removeZoomBar:function(){this.sliderEvents.un({mousedown:this.zoomBarDown,mousemove:this.zoomBarDrag,mouseup:this.zoomBarUp,dblclick:this.doubleClick,click:this.doubleClick});
this.sliderEvents.destroy();
this.divEvents.un({mousedown:this.divClick,mousemove:this.passEventToSlider,dblclick:this.doubleClick,click:this.doubleClick});
this.divEvents.destroy();
this.div.removeChild(this.zoombarDiv);
this.zoombarDiv=null;
this.div.removeChild(this.slider);
this.slider=null;
this.map.events.unregister("zoomend",this,this.moveZoomBar)
},passEventToSlider:function(evt){this.sliderEvents.handleBrowserEvent(evt)
},divClick:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return
}var x=evt.xy.x;
var left=OpenLayers.Util.pagePosition(evt.object)[0];
var levels=(x-left)/this.zoomStopWidth;
if(!this.map.fractionalZoom){levels=Math.floor(levels)
}var zoom=levels;
zoom=Math.min(Math.max(zoom,0),this.map.getNumZoomLevels()-1);
this.map.zoomTo(zoom);
OpenLayers.Event.stop(evt)
},zoomBarDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return
}this.map.events.on({mousemove:this.passEventToSlider,mouseup:this.passEventToSlider,scope:this});
this.mouseDragStart=evt.xy.clone();
this.zoomStart=evt.xy.clone();
this.div.style.cursor="move";
this.zoombarDiv.offsets=null;
OpenLayers.Event.stop(evt)
},zoomBarDrag:function(evt){if(this.mouseDragStart!=null){var deltaX=this.mouseDragStart.x-evt.xy.x;
var offsets=OpenLayers.Util.pagePosition(this.zoombarDiv);
if((evt.clientX-offsets[0])>0&&(evt.clientX-offsets[0])<parseInt(this.zoombarDiv.style.width)-2){var newLeft=parseInt(this.slider.style.left)-deltaX;
this.slider.style.left=newLeft+"px";
this.mouseDragStart=evt.xy.clone()
}OpenLayers.Event.stop(evt)
}},zoomBarUp:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return
}if(this.zoomStart){this.div.style.cursor="";
this.map.events.un({mouseup:this.passEventToSlider,mousemove:this.passEventToSlider,scope:this});
var deltaX=evt.xy.x-this.zoomStart.x;
var zoomLevel=this.map.zoom;
if(this.map.fractionalZoom){zoomLevel+=deltaX/this.zoomStopWidth;
zoomLevel=Math.min(Math.max(zoomLevel,0),this.map.getNumZoomLevels()-1)
}else{zoomLevel+=Math.round(deltaX/this.zoomStopWidth)
}this.map.zoomTo(zoomLevel);
this.moveZoomBar();
this.mouseDragStart=null;
OpenLayers.Event.stop(evt)
}},moveZoomBar:function(){var newLeft=this.map.getZoom()*this.zoomStopWidth+this.startLeft+1;
this.slider.style.left=newLeft+"px"
},CLASS_NAME:"OpenLayers.Control.HorizontalPanZoomBar"})
};
if(typeof OpenLayers!="undefined"&&typeof OpenLayers.Control.LoadingPanel=="undefined"){OpenLayers.Control.LoadingPanel=OpenLayers.Class(OpenLayers.Control,{counter:0,maximized:false,visible:true,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options])
},setVisible:function(visible){this.visible=visible;
if(visible){OpenLayers.Element.show(this.div)
}else{OpenLayers.Element.hide(this.div)
}},getVisible:function(){return this.visible
},hide:function(){this.setVisible(false)
},show:function(){this.setVisible(true)
},toggle:function(){this.setVisible(!this.getVisible())
},addLayer:function(evt){if(evt.layer){evt.layer.events.register("loadstart",this,this.increaseCounter);
evt.layer.events.register("loadend",this,this.decreaseCounter)
}},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);
this.map.events.register("preaddlayer",this,this.addLayer);
for(var i=0;
i<this.map.layers.length;
i++){var layer=this.map.layers[i];
layer.events.register("loadstart",this,this.increaseCounter);
layer.events.register("loadend",this,this.decreaseCounter)
}},increaseCounter:function(){this.counter++;
if(this.counter>0){if(!this.maximized&&this.visible){this.maximizeControl()
}}},decreaseCounter:function(){if(this.counter>0){this.counter--
}if(this.counter==0){if(this.maximized&&this.visible){this.minimizeControl()
}}},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);
return this.div
},minimizeControl:function(evt){this.div.style.display="none";
this.maximized=false;
if(evt!=null){OpenLayers.Event.stop(evt)
}},maximizeControl:function(evt){this.div.style.display="block";
var viewSize=this.map.getSize();
var msgW=viewSize.w;
var msgH=viewSize.h;
this.div.style.left=msgW/2-this.div.offsetWidth/2+"px";
this.div.style.top=msgH/2-this.div.offsetHeight/2+"px";
this.maximized=true;
if(evt!=null){OpenLayers.Event.stop(evt)
}},destroy:function(){if(this.map){this.map.events.unregister("preaddlayer",this,this.addLayer);
if(this.map.layers){for(var i=0;
i<this.map.layers.length;
i++){var layer=this.map.layers[i];
layer.events.unregister("loadstart",this,this.increaseCounter);
layer.events.unregister("loadend",this,this.decreaseCounter)
}}}OpenLayers.Control.prototype.destroy.apply(this,arguments)
},CLASS_NAME:"OpenLayers.Control.LoadingPanel"})
};
function WGGMarkerUtils(){}WGGMarkerUtils.addMarker=function(olMarkerLayer,olLonLat,image,attributes){if(olMarkerLayer==null){throw"WGGMarkerUtils.addMarker: olMarkerLayer must not be null"
}if(olLonLat==null){throw"WGGMarkerUtils.addMarker: olLonLat must not be null"
}if(image==null){throw"WGGMarkerUtils.addMarker: image must not be null"
}if(olMarkerLayer.map==null){throw"olMarkerLayer.map must not be null"
}var olMap=olMarkerLayer.map;
var size=new OpenLayers.Size(image.width,image.height);
var offset=new OpenLayers.Pixel(-(size.w/2),-size.h);
var icon=new OpenLayers.Icon(image.src,size,offset);
var marker=new OpenLayers.Marker(olLonLat,icon);
try{if(WGGDataTypeUtils.isArray(attributes)){marker.__attributes=attributes
}else{marker.__attributes=new Array(attributes)
}}catch(e){throw e
}olMarkerLayer.addMarker(marker)
};
if(typeof OpenLayers!="undefined"&&typeof OpenLayers.Control.ScaleBar=="undefined"){OpenLayers.Control.ScaleBar=OpenLayers.Class(OpenLayers.Control,{element:null,scale:1,displaySystem:"metric",minWidth:100,maxWidth:200,divisions:2,subdivisions:2,showMinorMeasures:false,abbreviateLabel:false,singleLine:false,align:"left",div:null,scaleText:"scale 1:",thousandsSeparator:"",measurementProperties:{english:{units:["miles","feet","inches"],abbr:["mi","ft","in"],inches:[63360,12,1]},metric:{units:["kilometers","meters","centimeters"],abbr:["km","m","cm"],inches:[39370.07874,39.370079,0.393701]}},limitedStyle:false,customStyles:null,defaultStyles:{Bar:{height:11,top:12,borderLeftWidth:0,borderRightWidth:0},BarAlt:{height:11,top:12,borderLeftWidth:0,borderRightWidth:0},MarkerMajor:{height:13,width:13,top:12,borderLeftWidth:0,borderRightWidth:0},MarkerMinor:{height:13,width:13,top:12,borderLeftWidth:0,borderRightWidth:0},NumbersBox:{height:13,width:40,top:24},LabelBox:{height:15,top:-2},LabelBoxSingleLine:{height:15,width:35,top:5,left:10}},appliedStyles:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);
if(!document.styleSheets){this.limitedStyle=true
}if(this.limitedStyle){this.appliedStyles=OpenLayers.Util.extend({},this.defaultStyles);
OpenLayers.Util.extend(this.appliedStyles,this.customStyles)
}this.element=document.createElement("div");
this.element.style.position="relative";
this.element.className=this.displayClass+"Wrapper";
this.labelContainer=document.createElement("div");
this.labelContainer.className=this.displayClass+"Units";
this.labelContainer.style.position="absolute";
this.graphicsContainer=document.createElement("div");
this.graphicsContainer.style.position="absolute";
this.graphicsContainer.className=this.displayClass+"Graphics";
this.numbersContainer=document.createElement("div");
this.numbersContainer.style.position="absolute";
this.numbersContainer.className=this.displayClass+"Numbers";
this.element.appendChild(this.graphicsContainer);
this.element.appendChild(this.labelContainer);
this.element.appendChild(this.numbersContainer)
},destroy:function(){this.map.events.unregister("moveend",this,this.onMoveend);
this.div.innerHTML="";
OpenLayers.Control.prototype.destroy.apply(this)
},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);
this.dxMarkerMajor=(this.styleValue("MarkerMajor","borderLeftWidth")+this.styleValue("MarkerMajor","width")+this.styleValue("MarkerMajor","borderRightWidth"))/2;
this.dxMarkerMinor=(this.styleValue("MarkerMinor","borderLeftWidth")+this.styleValue("MarkerMinor","width")+this.styleValue("MarkerMinor","borderRightWidth"))/2;
this.dxBar=(this.styleValue("Bar","borderLeftWidth")+this.styleValue("Bar","borderRightWidth"))/2;
this.dxBarAlt=(this.styleValue("BarAlt","borderLeftWidth")+this.styleValue("BarAlt","borderRightWidth"))/2;
this.dxNumbersBox=this.styleValue("NumbersBox","width")/2;
var classNames=["Bar","BarAlt","MarkerMajor","MarkerMinor"];
if(this.singleLine){classNames.push("LabelBoxSingleLine")
}else{classNames.push("NumbersBox","LabelBox")
}var vertDisp=0;
for(var classIndex=0;
classIndex<classNames.length;
++classIndex){var cls=classNames[classIndex];
vertDisp=Math.max(vertDisp,this.styleValue(cls,"top")+this.styleValue(cls,"height"))
}this.element.style.height=vertDisp+"px";
this.xOffsetSingleLine=this.styleValue("LabelBoxSingleLine","width")+this.styleValue("LabelBoxSingleLine","left");
this.div.appendChild(this.element);
this.map.events.register("moveend",this,this.onMoveend);
this.update();
return this.div
},onMoveend:function(){this.update()
},update:function(scale){if(this.map.baseLayer==null||!this.map.getScale()){return
}this.scale=(scale!=undefined)?scale:this.map.getScale();
this.element.title=this.scaleText+OpenLayers.Number.format(this.scale).replace(/,/g,".");
this.element.style.width=this.maxWidth+"px";
var comp=this.getComp();
this.setSubProps(comp);
this.labelContainer.innerHTML="";
this.graphicsContainer.innerHTML="";
this.numbersContainer.innerHTML="";
var numDiv=this.divisions*this.subdivisions;
var alignmentOffset={left:0+(this.singleLine?0:this.dxNumbersBox),center:(this.maxWidth/2)-(numDiv*this.subProps.pixels/2)-(this.singleLine?this.xOffsetSingleLine/2:0),right:this.maxWidth-(numDiv*this.subProps.pixels)-(this.singleLine?this.xOffsetSingleLine:this.dxNumbersBox)};
var xPos,measure,divNum,cls,left;
for(var di=0;
di<this.divisions;
++di){xPos=di*this.subdivisions*this.subProps.pixels+alignmentOffset[this.align];
this.graphicsContainer.appendChild(this.createElement("MarkerMajor"," ",xPos-this.dxMarkerMajor));
if(!this.singleLine){measure=(di==0)?0:OpenLayers.Number.format((di*this.subdivisions)*this.subProps.length,this.subProps.dec,this.thousandsSeparator);
this.numbersContainer.appendChild(this.createElement("NumbersBox",measure,xPos-this.dxNumbersBox))
}for(var si=0;
si<this.subdivisions;
++si){if((si%2)==0){cls="Bar";
left=xPos-this.dxBar
}else{cls="BarAlt";
left=xPos-this.dxBarAlt
}this.graphicsContainer.appendChild(this.createElement(cls," ",left,this.subProps.pixels));
if(si<this.subdivisions-1){divNum=(di*this.subdivisions)+si+1;
xPos=divNum*this.subProps.pixels+alignmentOffset[this.align];
this.graphicsContainer.appendChild(this.createElement("MarkerMinor"," ",xPos-this.dxMarkerMinor));
if(this.showMinorMeasures&&!this.singleLine){measure=divNum*this.subProps.length;
this.numbersContainer.appendChild(this.createElement("NumbersBox",measure,xPos-this.dxNumbersBox))
}}}}xPos=numDiv*this.subProps.pixels;
xPos+=alignmentOffset[this.align];
this.graphicsContainer.appendChild(this.createElement("MarkerMajor"," ",xPos-this.dxMarkerMajor));
measure=OpenLayers.Number.format(numDiv*this.subProps.length,this.subProps.dec,this.thousandsSeparator);
if(!this.singleLine){this.numbersContainer.appendChild(this.createElement("NumbersBox",measure,xPos-this.dxNumbersBox))
}var labelBox=document.createElement("div");
labelBox.style.position="absolute";
var labelText;
if(this.singleLine){labelText=measure;
labelBox.className=this.displayClass+"LabelBoxSingleLine";
labelBox.style.left=Math.round(xPos+this.styleValue("LabelBoxSingleLine","left"))+"px"
}else{labelText="";
labelBox.className=this.displayClass+"LabelBox";
labelBox.style.textAlign="center";
labelBox.style.width=Math.round(numDiv*this.subProps.pixels)+"px";
labelBox.style.left=Math.round(alignmentOffset[this.align])+"px";
labelBox.style.overflow="hidden"
}if(this.abbreviateLabel){labelText+=" "+this.subProps.abbr
}else{labelText+=" "+this.subProps.units
}labelBox.appendChild(document.createTextNode(labelText));
this.labelContainer.appendChild(labelBox)
},createElement:function(cls,text,left,width){var element=document.createElement("div");
element.className=this.displayClass+cls;
OpenLayers.Util.extend(element.style,{position:"absolute",textAlign:"center",overflow:"hidden",left:Math.round(left)+"px"});
element.appendChild(document.createTextNode(text));
if(width){element.style.width=Math.round(width)+"px"
}return element
},getComp:function(){var system=this.measurementProperties[this.displaySystem];
var numUnits=system.units.length;
var comp=new Array(numUnits);
var numDiv=this.divisions*this.subdivisions;
for(var unitIndex=0;
unitIndex<numUnits;
++unitIndex){comp[unitIndex]={};
var ppdu=OpenLayers.DOTS_PER_INCH*system.inches[unitIndex]/this.scale;
var minSDDisplayLength=((this.minWidth-this.dxNumbersBox)/ppdu)/numDiv;
var maxSDDisplayLength=((this.maxWidth-this.dxNumbersBox)/ppdu)/numDiv;
for(var vi=0;
vi<numDiv;
++vi){var minNumber=minSDDisplayLength*(vi+1);
var maxNumber=maxSDDisplayLength*(vi+1);
var num=this.getHandsomeNumber(minNumber,maxNumber);
var compNum={value:(num.value/(vi+1)),score:0,tie:0,dec:0,displayed:0};
for(var vi2=0;
vi2<numDiv;
++vi2){var position=num.value*(vi2+1)/(vi+1);
var num2=this.getHandsomeNumber(position,position);
var major=((vi2+1)%this.subdivisions==0);
var last=((vi2+1)==numDiv);
if((this.singleLine&&last)||(!this.singleLine&&(major||this.showMinorMeasures))){compNum.score+=num2.score;
compNum.tie+=num2.tie;
compNum.dec=Math.max(compNum.dec,num2.dec);
compNum.displayed+=1
}else{compNum.score+=num2.score/this.subdivisions;
compNum.tie+=num2.tie/this.subdivisions
}}compNum.score*=(unitIndex+1)*compNum.tie/compNum.displayed;
comp[unitIndex][vi]=compNum
}}return comp
},setSubProps:function(comp){var system=this.measurementProperties[this.displaySystem];
var score=Number.POSITIVE_INFINITY;
var tie=Number.POSITIVE_INFINITY;
for(var unitIndex=0;
unitIndex<comp.length;
++unitIndex){var ppdu=OpenLayers.DOTS_PER_INCH*system.inches[unitIndex]/this.scale;
for(var vi in comp[unitIndex]){var compNum=comp[unitIndex][vi];
if((compNum.score<score)||((compNum.score==score)&&(compNum.tie<tie))){this.subProps={length:compNum.value,pixels:ppdu*compNum.value,units:system.units[unitIndex],abbr:system.abbr[unitIndex],dec:compNum.dec};
score=compNum.score;
tie=compNum.tie
}}}},styleValue:function(selector,key){var value=0;
if(this.limitedStyle){value=this.appliedStyles[selector][key]
}else{selector="."+this.displayClass+selector;
rules:for(var i=document.styleSheets.length-1;
i>=0;
--i){var sheet=document.styleSheets[i];
if(!sheet.disabled){var allRules;
try{if(typeof(sheet.cssRules)=="undefined"){if(typeof(sheet.rules)=="undefined"){continue
}else{allRules=sheet.rules
}}else{allRules=sheet.cssRules
}}catch(err){continue
}if(allRules!=null){for(var ruleIndex=0;
ruleIndex<allRules.length;
++ruleIndex){var rule=allRules[ruleIndex];
if(rule.selectorText&&(rule.selectorText.toLowerCase()==selector.toLowerCase())){if(rule.style[key]!=""){value=parseInt(rule.style[key]);
break rules
}}}}}}}return value?value:0
},getHandsomeNumber:function(small,big,sigFigs){sigFigs=(sigFigs==null)?10:sigFigs;
var num={value:small,score:Number.POSITIVE_INFINITY,tie:Number.POSITIVE_INFINITY,dec:3};
var cmult,max,dec,tmult,multiplier,score,tie;
for(var hexp=0;
hexp<3;
++hexp){cmult=Math.pow(2,(-1*hexp));
max=Math.floor(Math.log(big/cmult)/Math.LN10);
for(var texp=max;
texp>(max-sigFigs+1);
--texp){dec=Math.max(hexp-texp,0);
tmult=cmult*Math.pow(10,texp);
if((tmult*Math.floor(big/tmult))>=small){if(small%tmult==0){multiplier=small/tmult
}else{multiplier=Math.floor(small/tmult)+1
}score=multiplier+(2*hexp);
tie=(texp<0)?(Math.abs(texp)+1):texp;
if((score<num.score)||((score==num.score)&&(tie<num.tie))){num.value=parseFloat((tmult*multiplier).toFixed(dec));
num.score=score;
num.tie=tie;
num.dec=dec
}}}}return num
},CLASS_NAME:"OpenLayers.Control.ScaleBar"})
};
function WGGOpenLayersPatches(){}WGGOpenLayersPatches.injectMethods=function(){if(!OpenLayers.Map.prototype.getLayersByName){OpenLayers.Map.prototype.getLayersByName=function(name){var regExp=new RegExp("\\b"+name+"\\b","g");
var layers=new Array();
for(var i=0;
i<this.layers.length;
i++){if(regExp.test(this.layers[i].name)){layers.push(this.layers[i])
}}return layers
}
}var veMapResizeMethod=OpenLayers.Layer.VirtualEarth.prototype.onMapResize;
if(veMapResizeMethod){var veMapResizeMethodCompressed=WGGStringUtils.trim(veMapResizeMethod.toString().replace(/\s/gm,""));
if(veMapResizeMethodCompressed=="function(){}"){OpenLayers.Layer.VirtualEarth.prototype.onMapResize=function(){var size=this.map.getSize();
this.mapObject.Resize(size.w,size.h)
}
}}OpenLayers.Control.DrawFeature.prototype.initialize=function(layer,handler,options){this.EVENT_TYPES=OpenLayers.Control.DrawFeature.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);
OpenLayers.Control.prototype.initialize.apply(this,[options]);
this.callbacks=OpenLayers.Util.extend({done:this.drawFeature,modify:function(vertex,feature){this.layer.events.triggerEvent("sketchmodified",{vertex:vertex,feature:feature})
},create:function(vertex,feature){this.layer.events.triggerEvent("sketchstarted",{vertex:vertex,feature:feature})
}},this.callbacks);
this.layer=layer;
var sketchStyle=this.layer.styleMap&&this.layer.styleMap.styles.temporary;
if(sketchStyle){this.handlerOptions=this.handlerOptions||{};
this.handlerOptions.layerOptions=OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions,{styleMap:new OpenLayers.StyleMap({"default":sketchStyle})})
}this.handler=new handler(this,this.callbacks,this.handlerOptions);
this.deleteCodes=[46,68];
var keyboardOptions={keydown:this.handleKeypress};
this.handlers={keyboard:new OpenLayers.Handler.Keyboard(this,keyboardOptions)};
this.handlers.keyboard.activate()
};
OpenLayers.Control.DrawFeature.prototype.handleKeypress=function(evt){var code=evt.keyCode;
if(this.handler.CLASS_NAME!="OpenLayers.Handler.Polygon"){return
}if(OpenLayers.Util.indexOf(this.deleteCodes,code)==-1){return
}if(!this.handler.polygon){return
}var layer=this.handler.polygon.layer;
var map=layer.map;
var features=layer.features;
if(features&&features.length>0){var fLength=features.length;
var lastFeature=features[fLength-1];
if(lastFeature){var geometry=lastFeature.geometry;
var components=geometry.components;
if(components&&components.length>0){var cLength=components.length;
var lastComponent=components[cLength-1];
if(lastComponent){var subComponents=lastComponent.components;
var sLength=subComponents.length;
if((sLength-3)>0){var lastSubComponent=subComponents[sLength-2];
var nextToLastSubComponent=subComponents[sLength-3];
lastSubComponent.parent.removeComponent(lastSubComponent);
var px=map.getPixelFromLonLat(nextToLastSubComponent);
this.handler.modifyFeature(px)
}}}}}};
OpenLayers.Handler.Polygon.prototype.mousedown=function(evt){if(evt.button==2){return false
}if(this.lastDown&&this.lastDown.equals(evt.xy)){return false
}if(this.lastDown==null){if(this.persist){this.destroyFeature()
}this.createFeature(evt.xy)
}else{if((this.lastUp==null)||!this.lastUp.equals(evt.xy)){this.addPoint(evt.xy)
}}this.mouseDown=true;
this.lastDown=evt.xy;
this.drawing=true;
return false
};
if(OpenLayers.Popup.FramedCloud){OpenLayers.Popup.FramedCloud=OpenLayers.Class(OpenLayers.Popup.Framed,{contentDisplayClass:"olFramedCloudPopupContent",autoSize:true,panMapIfOutOfView:true,imageSize:new OpenLayers.Size(676,736),isAlphaImage:false,fixedRelativePosition:false,positionBlocks:{tl:{offset:new OpenLayers.Pixel(44,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,50,0,0),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,18),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-638,-632)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(0,-688)}]},tr:{offset:new OpenLayers.Pixel(-45,0),padding:new OpenLayers.Bounds(8,40,8,9),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,50,0,0),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,19),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-638,-631)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(0,0,null,null),position:new OpenLayers.Pixel(-215,-687)}]},bl:{offset:new OpenLayers.Pixel(45,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-638,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(null,null,0,0),position:new OpenLayers.Pixel(-101,-674)}]},br:{offset:new OpenLayers.Pixel(-44,0),padding:new OpenLayers.Bounds(8,9,8,40),blocks:[{size:new OpenLayers.Size("auto","auto"),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,"auto"),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-638,0)},{size:new OpenLayers.Size("auto",21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-638,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(0,null,null,0),position:new OpenLayers.Pixel(-311,-674)}]}},minSize:new OpenLayers.Size(200,100),maxSize:new OpenLayers.Size(600,660),initialize:function(id,lonlat,contentSize,contentHTML,anchor,closeBox,closeBoxCallback){this.imageSrc=OpenLayers.Util.getImagesLocation()+"cloud-popup-relative.png";
OpenLayers.Popup.Framed.prototype.initialize.apply(this,arguments);
this.contentDiv.className=this.contentDisplayClass
},destroy:function(){OpenLayers.Popup.Framed.prototype.destroy.apply(this,arguments)
},CLASS_NAME:"OpenLayers.Popup.FramedCloud"})
}};
function WGGBilling(url,ajaxLoader){var self=JSINER.extend(this,"WGGServerRequest");
self.url=url;
self.ajaxLoader=null;
self.setAjaxLoader(ajaxLoader);
if(self.ajaxLoader!=null){self.ajaxLoader.initialize()
}self.observers=[];
self.paramsHashMap=new WGGHashMap();
self.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){self.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){self.debugInterface=new WGGNullDebugInterface()
}this.bBillingOk=false;
return self
}WGGBilling.prototype.update=function(){this.debugInterface.debug("WGGBilling.update");
if(arguments.length==0){return
}var xmlDoc=arguments[0];
if(xmlDoc==null){return
}this.debugInterface.debug(xmlDoc);
try{var checkkeyNode=xmlDoc.getElementsByTagName("CHECKKEY")[0];
if(!checkkeyNode){this.debugInterface.warn("checkkeyNode must not be null or undefined");
return
}var resultNode=checkkeyNode.getElementsByTagName("RESULT")[0];
if(!resultNode){this.debugInterface.warn("resultNode must not be null or undefined");
return
}var statusNode=resultNode.getElementsByTagName("STATUS")[0];
if(statusNode){var status=statusNode.firstChild.nodeValue;
if(WGGBrowserDetector.IS_OPERA){this.ajaxLoader.initialize()
}if(status!="TRUE"){var reasonNode=resultNode.getElementsByTagName("REASON")[0];
var reason=(reasonNode!=null)?reasonNode.firstChild.nodeValue:null;
this.notify({STATUS:status,REASON:reason})
}else{this.bBillingOk=true;
this.notify({STATUS:status})
}}this.onUpdate()
}catch(e){this.debugInterface.error("error while processing xmlDoc, xmlDoc is probably not a XMLDocument-instance, see description:");
this.debugInterface.error(e)
}};
function WGGGeocoder(url,ajaxLoader){var self=JSINER.extend(this,"WGGServerRequest");
self.url=url;
self.ajaxLoader=null;
self.setAjaxLoader(ajaxLoader);
if(self.ajaxLoader!=null){self.ajaxLoader.initialize()
}self.observers=[];
self.paramsHashMap=new WGGHashMap();
self.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){self.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){self.debugInterface=new WGGNullDebugInterface()
}return self
}WGGGeocoder.prototype.update=function(){this.debugInterface.debug("WGGGeocoder.update");
if(arguments.length==0){return
}var xmlDoc=arguments[0];
if(xmlDoc==null){return
}this.debugInterface.debug(xmlDoc);
try{var geocodeNode=xmlDoc.getElementsByTagName("GEOCODE")[0];
if(!geocodeNode){throw"geocodeNode must not be null or undefined"
}var inputNodes=geocodeNode.getElementsByTagName("INPUT");
if(inputNodes==null){this.notify();
return
}var summaryNodes=geocodeNode.getElementsByTagName("SUMMARY");
if(summaryNodes==null){this.notify();
return
}var outputNodes=geocodeNode.getElementsByTagName("OUTPUT");
if(outputNodes==null){this.notify();
return
}var inputNode=inputNodes[0];
var inputObject=WGGXmlUtils.parseChildNodes(inputNode);
var summaryNode=summaryNodes[0];
var summaryObject=WGGXmlUtils.parseChildNodes(summaryNode);
var prj=summaryObject.PRJ||null;
var outputNode=outputNodes[0];
var notified=false;
if(outputNode){var setNodes=outputNode.getElementsByTagName("SET");
if(setNodes!=null){var locations=new Array();
for(var i=0;
i<setNodes.length;
i++){var setNode=setNodes[i];
var childNodes=setNode.childNodes;
var location=new WGGLocation();
location.prj=prj;
var desc=new Object();
for(var j=0;
j<childNodes.length;
j++){var childNode=childNodes[j];
if(childNode==null){continue
}var nodeValue=null;
if(childNode.nodeType==3){nodeValue=childNode.nodeValue
}else{if(childNode.firstChild!=null){nodeValue=childNode.firstChild.nodeValue
}}var nodeName=childNode.nodeName;
switch(nodeName){case"ID":location.id=parseInt(nodeValue);
break;
case"XCOOR":location.setX(parseFloat(nodeValue));
break;
case"YCOOR":location.setY(parseFloat(nodeValue));
break;
default:desc[nodeName]=nodeValue;
location.setDesc(desc)
}}locations[i]=location
}this.notify({INPUT:inputObject,SUMMARY:summaryObject,OUTPUT:locations});
notified=true
}}if(!notified){this.notify({INPUT:inputObject,SUMMARY:summaryObject})
}}catch(e){this.debugInterface.error("error while processing xmlDoc, xmlDoc is probably not a XMLDocument-instance, see description:");
this.debugInterface.error(e)
}};
function WGGGetRouteRequest(url,ajaxLoader){var self=JSINER.extend(this,"WGGServerRequest");
self.url=url;
self.ajaxLoader=null;
self.setAjaxLoader(ajaxLoader);
if(self.ajaxLoader!=null){ajaxLoader.initialize()
}self.observers=[];
self.paramsHashMap=new WGGHashMap();
self.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){self.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){self.debugInterface=new WGGNullDebugInterface()
}self.source=null;
self.extent=null;
self.points=null;
self.locations=null;
return self
}WGGGetRouteRequest.prototype.getPoints=function(){return this.points
};
WGGGetRouteRequest.prototype.getLocations=function(){return this.locations
};
WGGGetRouteRequest.prototype.update=function(){this.debugInterface.debug("WGGGetRouteRequest.update");
if(arguments.length==0){return
}var xmlDoc=arguments[0];
if(xmlDoc==null){return
}try{var routingNode=xmlDoc.getElementsByTagName("ROUTING")[0];
var summaryNode=routingNode.getElementsByTagName("SUMMARY")[0];
var segmentsNode=summaryNode.getElementsByTagName("SEGMENTS")[0];
if(segmentsNode){var segments=segmentsNode.firstChild.nodeValue;
if(segments==0){this.debugInterface.info("error while processing getroute xml File. xml is probably not a XMLDocument-instance, or the file was not found");
this.notify({POINTS:""});
return
}sourceNode=summaryNode.getElementsByTagName("SOURCE")[0];
this.source=sourceNode.firstChild.nodeValue;
this.debugInterface.debug("source: "+this.source);
var extentNode=summaryNode.getElementsByTagName("EXTENT")[0];
var leftNode=extentNode.getElementsByTagName("LEFT")[0];
var rightNode=extentNode.getElementsByTagName("RIGHT")[0];
var topNode=extentNode.getElementsByTagName("TOP")[0];
var bottomNode=extentNode.getElementsByTagName("BOTTOM")[0];
this.extent=[leftNode,bottomNode,rightNode,topNode];
var resultNodes=routingNode.getElementsByTagName("RESULTS")[0].getElementsByTagName("RESULT");
var resultNodeCount=resultNodes.length;
this.debugInterface.debug("RESULT nodes count: "+resultNodeCount);
this.locations=[];
for(var i=0;
i<resultNodes.length;
i++){var resultNode=resultNodes[i];
var turnNode=resultNode.getElementsByTagName("TURN")[0];
var turn=WGGXmlUtils.getChildValue(turnNode);
var attrX=WGGXmlUtils.getChildValue(turnNode.getAttributeNode("X"));
var attrY=WGGXmlUtils.getChildValue(turnNode.getAttributeNode("Y"));
var turn2=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("TURN2")[0]);
var tcd=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("TCD")[0]);
var arn=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("ARN")[0]);
var rdc=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("RDC")[0]);
var frc=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("FRC")[0]);
var km=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("KM")[0]);
var kmTotal=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("KMTOTAL")[0]);
var time=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("TIME")[0]);
var timeTotal=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("TIMETOTAL")[0]);
var minutes=WGGXmlUtils.getChildValue(resultNode.getElementsByTagName("MINUTES")[0]);
var extent=resultNode.getElementsByTagName("EXTENT")[0];
var left=WGGXmlUtils.getChildValue(extent.getElementsByTagName("LEFT")[0]);
var right=WGGXmlUtils.getChildValue(extent.getElementsByTagName("RIGHT")[0]);
var top=WGGXmlUtils.getChildValue(extent.getElementsByTagName("TOP")[0]);
var bottom=WGGXmlUtils.getChildValue(extent.getElementsByTagName("BOTTOM")[0]);
var desc={SET:(i+1),TURN:turn,X:((attrX)?attrX.replace(",","."):null),Y:((attrY)?attrY.replace(",","."):null),TURN2:turn2,TCD:tcd,ARN:arn,RDC:rdc,FRC:frc,KM:km,KMTOTAL:kmTotal,TIME:time,TIMETOTAL:timeTotal,MINUTES:minutes,EXTENT:new WGGExtent(left,bottom,right,top)};
this.locations[i]=new WGGLocation(attrX,attrY,i,desc)
}var vNodes=routingNode.getElementsByTagName("VERTICES")[0].getElementsByTagName("V");
var vNodeCount=vNodes.length;
this.debugInterface.debug("V nodes count: "+vNodeCount);
this.points=[];
for(var i=0;
i<vNodeCount;
i++){var vNode=vNodes[i];
var attrX=vNode.getAttributeNode("X");
var attrY=vNode.getAttributeNode("Y");
attrXValue=WGGXmlUtils.getChildValue(attrX);
attrYValue=WGGXmlUtils.getChildValue(attrY);
var x=parseFloat(attrXValue.replace(",","."));
var y=parseFloat(attrYValue.replace(",","."));
this.points[i]=new WGGPoint(x,y)
}this.notify({POINTS:this.points})
}}catch(e){this.debugInterface.error("error while processing xmlDoc, xmlDoc is probably not a XMLDocument-instance, see description:");
this.debugInterface.error(e)
}};
function WGGMakeRouteRequest(url,ajaxLoader){var self=JSINER.extend(this,"WGGServerRequest");
self.url=url;
self.ajaxLoader=null;
self.setAjaxLoader(ajaxLoader);
if(self.ajaxLoader!=null){self.ajaxLoader.initialize()
}self.observers=[];
self.paramsHashMap=new WGGHashMap();
self.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){self.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){self.debugInterface=new WGGNullDebugInterface()
}self.source=null;
return self
}WGGMakeRouteRequest.prototype.update=function(){this.debugInterface.debug("WGGMakeRouteRequest.update");
if(arguments.length==0){return
}var xmlDoc=arguments[0];
if(xmlDoc==null){return
}try{var routingNode=xmlDoc.getElementsByTagName("ROUTING")[0];
if(!routingNode){this.debugInterface.warn("routingNode is null or undefined");
return
}var summaryNode=routingNode.getElementsByTagName("SUMMARY")[0];
var segmentsNode=summaryNode.getElementsByTagName("SEGMENTS")[0];
if(segmentsNode){var segments=segmentsNode.firstChild.nodeValue;
if(segments==0){this.debugInterface.info("route could not be calculated");
this.notify({SOURCE:this.source});
return
}sourceNode=summaryNode.getElementsByTagName("SOURCE")[0];
this.source=sourceNode.firstChild.nodeValue;
this.debugInterface.debug("source: "+this.source);
this.notify({SOURCE:this.source})
}}catch(e){this.debugInterface.error("error while processing xmlDoc, xmlDoc is probably not a XMLDocument-instance, see description:");
this.debugInterface.error(e)
}};
function WGGNextLocator(url,ajaxLoader){var self=JSINER.extend(this,"WGGServerRequest");
self.url=url;
self.ajaxLoader=null;
self.setAjaxLoader(ajaxLoader);
if(self.ajaxLoader!=null){self.ajaxLoader.initialize()
}self.observers=[];
self.paramsHashMap=new WGGHashMap();
self.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){self.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){self.debugInterface=new WGGNullDebugInterface()
}return self
}WGGNextLocator.prototype.update=function(){this.debugInterface.debug("WGGNextLocator.update");
if(arguments.length==0){return
}var xmlDoc=arguments[0];
if(xmlDoc==null){return
}this.debugInterface.debug(xmlDoc);
try{var nextdoorXmlNode=xmlDoc.getElementsByTagName("NEXTDOORXML")[0];
if(!nextdoorXmlNode){throw"nextdoorXmlNode must not be null or undefined"
}var resultsNodes=nextdoorXmlNode.getElementsByTagName("RESULTS");
if(resultsNodes==null){this.notify(new Array());
return
}var resultsNode=resultsNodes[0];
if(resultsNode){var resultNodes=resultsNode.getElementsByTagName("RESULT");
if(resultNodes!=null){var locations=new Array();
for(var i=0;
i<resultNodes.length;
i++){var resultNode=resultNodes[i];
var childNodes=resultNode.childNodes;
var location=new WGGLocation();
var desc=new Object();
for(var j=0;
j<childNodes.length;
j++){var childNode=childNodes[j];
if(childNode.firstChild==null){continue
}var nodeValue=childNode.firstChild.nodeValue;
var nodeName=childNode.nodeName;
switch(nodeName){case"XCO":location.setX(parseFloat(nodeValue));
break;
case"YCO":location.setY(parseFloat(nodeValue));
break;
case"SID":location.setId(nodeValue);
case"SET":break;
default:desc[nodeName]=nodeValue;
location.setDesc(desc)
}}locations[i]=location
}this.notify({LOCATIONS:locations})
}}}catch(e){this.debugInterface.error("error while processing xmlDoc, xmlDoc is probably not a XMLDocument-instance, see description:");
this.debugInterface.error(e)
}};
function WGGProprietaryRoute(options,olVectorLayer,layerStyleOptions,bBill,descriptionDiv,onErrorFunction){this.options=options;
this.olVectorLayer=olVectorLayer;
this.layerStyleOptions=null;
if(!WGGDataTypeUtils.isUndefined(layerStyleOptions)){this.layerStyleOptions=layerStyleOptions
}this.bBill=true;
if(!WGGDataTypeUtils.isUndefined(bBill)){this.bBill=bBill
}if(!WGGDataTypeUtils.isUndefined(descriptionDiv)){this.descriptionDiv=descriptionDiv
}else{this.descriptionDiv=null
}this.verifier=null;
this.makeRouteRequest=null;
this.getRouteRequest=null;
this.onAnimate=null;
if(!WGGDataTypeUtils.isUndefined(onErrorFunction)&&WGGDataTypeUtils.isFunction(onErrorFunction)){this.onErrorFunction=onErrorFunction
}else{this.onErrorFunction=null
}this.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){this.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){this.debugInterface=new WGGNullDebugInterface()
}this.activ=null;
this.pointsOnLine=null;
this.currentIndex=0
}WGGProprietaryRoute.prototype.buildURL=function(path){return"http://"+location.host+path
};
WGGProprietaryRoute.prototype.getGetRouteRequest=function(){return this.getRouteRequest
};
WGGProprietaryRoute.prototype.getMakeRouteRequest=function(){return this.makeRouteRequest
};
WGGProprietaryRoute.prototype.compute=function(){var serverRequestQueue=new WGGServerRequestQueue(this,this.show);
this.verifier=new WGGVerifier(this.buildURL("/getkey.php5"),new WGGAjaxLoader());
this.verifier.addParam("USR",this.options.USR);
this.verifier.addParam("CID",this.options.CID);
serverRequestQueue.addServerRequest(this.verifier);
this.makeRouteRequest=new WGGMakeRouteRequest(this.buildURL("/bingapi/routing/makeroute.php5"),new WGGAjaxLoader());
for(var paramName in this.options){this.makeRouteRequest.addParam(paramName,this.options[paramName])
}serverRequestQueue.addServerRequest(this.makeRouteRequest);
this.getRouteRequest=new WGGGetRouteRequest(this.buildURL("/bingapi/routing/getroute.php5"),new WGGAjaxLoader());
serverRequestQueue.addServerRequest(this.getRouteRequest);
serverRequestQueue.start()
};
WGGProprietaryRoute.prototype.onShown=function(){};
WGGProprietaryRoute.prototype.show=function(){var points=this.getRouteRequest.points;
if(!WGGDataTypeUtils.isArray(points)){this.onError();
return
}var olPoints=new Array();
for(var i=0;
i<points.length;
i++){olPoints.push(new OpenLayers.Geometry.Point(points[i].x,points[i].y))
}var layerStyle=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style["default"]);
if(this.layerStyleOptions){layerStyle=OpenLayers.Util.extend(layerStyle,this.layerStyleOptions)
}else{layerStyle.fillOpacity=0.7;
layerStyle.strokeWidth=5;
layerStyle.strokeOpacity=0.7;
layerStyle.markerOpacity=0.7;
layerStyle.strokeColor="#5457E0"
}if(this.bBill==true){var billing=new WGGBilling(this.buildURL("/accounting/checkkey.php5"),new WGGAjaxLoader());
billing.addParam("USR",this.options.USR);
billing.addParam("APP","WGGProprietaryRoute");
billing.addParam("BLG","ROUTEMAP");
billing.addParam("KEY",this.verifier.lastKey);
billing.send();
billing.onUpdate=function(){if(this.bBillingOk==true){WGGAbstractDebugInterface.gDebugInterface.debug("billing for WGGProprietaryRoute successful")
}else{WGGAbstractDebugInterface.gDebugInterface.error("billing for WGGProprietaryRoute failed")
}}
}this.olVectorLayer.style=layerStyle;
var olLineString=new OpenLayers.Geometry.LineString(olPoints);
this.olVectorLayer.addFeatures(new OpenLayers.Feature.Vector(olLineString));
this.olVectorLayer.map.zoomToExtent(olLineString.getBounds());
if(this.descriptionDiv!=null){if(this.options.LNG){var lngSource=this.getDescriptionLanguageMap(this.options.LNG)
}else{var lngSource=this.getDescriptionLanguageMap("EN")
}for(var i=0;
i<this.descriptionDiv.childNodes.length;
i++){this.descriptionDiv.removeChild(this.descriptionDiv.childNodes[i])
}var contentNode=this.descriptionDiv;
var tbl=document.createElement("table");
tbl.setAttribute("id","routeTable");
tbl.setAttribute("class","routeList");
tbl.setAttribute("className","routeList");
var tblBody=document.createElement("tbody");
tbl.appendChild(tblBody);
contentNode.appendChild(tbl);
var newRow=tblBody.insertRow(0);
var textNode=document.createTextNode(lngSource.NUMBER);
var cellNode=newRow.insertCell(0);
cellNode.setAttribute("class","routeListHeader");
cellNode.setAttribute("className","routeListHeader");
cellNode.appendChild(textNode);
var textNode=document.createTextNode("");
var cellNode=newRow.insertCell(1);
cellNode.setAttribute("class","routeListHeader");
cellNode.setAttribute("className","routeListHeader");
cellNode.appendChild(textNode);
var textNode=document.createTextNode(lngSource.DESC);
var cellNode=newRow.insertCell(2);
cellNode.setAttribute("class","routeListHeader");
cellNode.setAttribute("className","routeListHeader");
cellNode.appendChild(textNode);
var textNode=document.createTextNode(lngSource.DURATION);
var cellNode=newRow.insertCell(3);
cellNode.setAttribute("class","routeListHeaderKmTime");
cellNode.setAttribute("className","routeListHeaderKmTime");
cellNode.appendChild(textNode);
var textNode=document.createTextNode(lngSource.LENGTH);
var cellNode=newRow.insertCell(4);
cellNode.setAttribute("class","routeListHeaderKmTime");
cellNode.setAttribute("className","routeListHeaderKmTime");
cellNode.appendChild(textNode);
var descPoints=this.getGetRouteRequest().getLocations();
for(var i=0;
i<descPoints.length;
i++){var newRow=tblBody.insertRow(tblBody.rows.length);
var infoToInsert=descPoints[i].getDesc();
var textNode=document.createTextNode(infoToInsert.SET+".");
var cellNode=newRow.insertCell(0);
cellNode.appendChild(textNode);
var imgNode=document.createElement("img");
imgNode.setAttribute("src","imgRoute/"+infoToInsert.TCD+".png");
var cellNode=newRow.insertCell(1);
cellNode.appendChild(imgNode);
if(i==0){var textNode1=document.createTextNode(decodeURI(infoToInsert.TURN)+". ")
}else{if((i+1)==descPoints.length){var textNode1=document.createTextNode(decodeURI(infoToInsert.TURN)+". ")
}else{var textNode1=document.createTextNode(infoToInsert.TURN+". ")
}}var textNode2=document.createTextNode(infoToInsert.TURN2+". ");
var breakNode=document.createElement("br");
var linkNode=document.createElement("a");
linkNode.setAttribute("href","javascript:map.setCenter("+infoToInsert.X+","+infoToInsert.Y+",map.getMaxScaleLevel());");
linkNode.setAttribute("class","routeLinkText");
linkNode.setAttribute("className","routeLinkText");
linkNode.appendChild(textNode1);
var cellNode=newRow.insertCell(2);
cellNode.appendChild(linkNode);
cellNode.appendChild(breakNode);
if(i+1!=descPoints.length){cellNode.appendChild(textNode2)
}if((i+1)==descPoints.length){var textNode=document.createTextNode(infoToInsert.TIMETOTAL+" min");
var cellNode=newRow.insertCell(3);
cellNode.setAttribute("width","100");
cellNode.setAttribute("class","kmTimeTextAll");
cellNode.setAttribute("className","kmTimeTextAll");
cellNode.appendChild(textNode)
}else{var textNode=document.createTextNode(infoToInsert.TIME+" min");
var cellNode=newRow.insertCell(3);
cellNode.setAttribute("class","kmTimeText");
cellNode.setAttribute("className","kmTimeText");
cellNode.setAttribute("width","100");
cellNode.appendChild(textNode)
}if((i+1)==descPoints.length){var textNode=document.createTextNode(infoToInsert.KMTOTAL+" km");
var cellNode=newRow.insertCell(4);
cellNode.setAttribute("class","kmTimeTextAll");
cellNode.setAttribute("className","kmTimeTextAll");
cellNode.setAttribute("width","100");
cellNode.appendChild(textNode)
}else{var textNode=document.createTextNode(infoToInsert.KM+" km");
var cellNode=newRow.insertCell(4);
cellNode.setAttribute("class","kmTimeText");
cellNode.setAttribute("className","kmTimeText");
cellNode.setAttribute("width","100");
cellNode.appendChild(textNode)
}}}this.onShown()
};
WGGProprietaryRoute.prototype.getPointsOnLine=function(point1,point2,count){var a=(point2.y-point1.y)/(point2.x-point1.x);
var b=point1.y-a*point1.x;
if(Math.abs(point1.x-point2.x)<2){point1.x=point2.x
}if(Math.abs(point1.y-point2.y)<2){point1.y=point2.y
}var points=new Array();
if(a==Number.POSITIVE_INFINITY||a==Number.NEGATIVE_INFINITY){var directionY=((point2.y-point1.y)>0)?1:-1;
yDistPart=1;
count=Math.abs(point1.y-point2.y);
for(var i=0;
i<=count;
i++){var tmpX=point1.x;
var tmpY=point1.y+directionY*yDistPart*i;
points.push(new WGGPoint(tmpX,tmpY))
}}else{if(a==0){var directionX=((point2.x-point1.x)>0)?1:-1;
xDistPart=1;
count=Math.abs(point1.x-point2.x);
for(var i=0;
i<=count;
i++){var tmpX=point1.x+directionX*xDistPart*i;
var tmpY=point1.y;
points.push(new WGGPoint(tmpX,tmpY))
}}else{var xDist=Math.abs(point1.x-point2.x);
var directionX=((point2.x-point1.x)>0)?1:-1;
if(xDist>0&&xDist<count){count=xDist
}var xDistPart=parseInt(xDist/count);
if(xDistPart==0){points.push(point1);
points.push(point2)
}else{while(xDistPart>0){count=parseInt(xDist/xDistPart);
for(var i=0;
i<=count;
i++){var tmpX=point1.x+directionX*xDistPart*i;
var tmpY=parseInt(a*tmpX+b);
points.push(new WGGPoint(tmpX,tmpY))
}xDist=xDist-((count+2)*xDistPart);
xDistPart=parseInt(xDist/count)
}}}}return points
};
WGGProprietaryRoute.prototype.animate=function(){if(this.getRouteRequest==null){return
}if(this.getRouteRequest.points==null){return
}if(this.getRouteRequest.points.length==0){return
}if(this.pointsOnLine==null){this.pointsOnLine=this.getRouteRequest.points
}this.terminateAnimation();
if(!(this.currentIndex<this.pointsOnLine.length)){this.currentIndex=0;
return
}this.olVectorLayer.map.setCenter(new OpenLayers.LonLat(this.pointsOnLine[this.currentIndex].x,this.pointsOnLine[this.currentIndex].y));
this.debugInterface.debug("setCenter");
window.setTimeout(function(){this.startAnimation()
}.__wggClosure(this),100);
if(this.onAnimate!=null){this.onAnimate.call(this)
}this.currentIndex++
};
WGGProprietaryRoute.prototype.startAnimation=function(){var self=this;
if(this.activ!=null){return
}this.activ=window.setInterval(function(){self.animate()
},40)
};
WGGProprietaryRoute.prototype.terminateAnimation=function(){var self=this;
window.clearInterval(this.activ);
this.activ=null
};
WGGProprietaryRoute.prototype.onError=function(){if(this.onErrorFunction!=null){this.onErrorFunction.call(this)
}else{alert("route could not be calculated")
}};
WGGProprietaryRoute.prototype.getDescriptionLanguageMap=function(lng){if(lng=="DE"){return{NUMBER:"Nr.",DESC:"Ihre Wegbeschreibung",LENGTH:"Distanz",DURATION:"Dauer",LENGTH_TOTAL:"Gesamte Distanz:",DURATION_TOTAL:"Gesamte Dauer"}
}else{return{NUMBER:"No.",DESC:"Your route description",LENGTH:"Distance",DURATION:"Time",LENGTH_TOTAL:"Total Distance",DURATION_TOTAL:"Total Time"}
}};
function WGGVerifier(url,ajaxLoader){var self=JSINER.extend(this,"WGGServerRequest");
self.url=url;
self.ajaxLoader=null;
self.setAjaxLoader(ajaxLoader);
if(self.ajaxLoader!=null){self.ajaxLoader.initialize()
}self.observers=[];
self.paramsHashMap=new WGGHashMap();
self.debugInterface=null;
try{if(WGGDataTypeUtils.isObject(WGGAbstractDebugInterface.gDebugInterface)){self.debugInterface=WGGAbstractDebugInterface.gDebugInterface
}else{throw"WGGAbstractDebugInterface.gDebugInterface probably undefined"
}}catch(e){self.debugInterface=new WGGNullDebugInterface()
}self.lastKey="";
self.lastKeyTimeStamp=0;
self.timeRange=300000;
return self
}WGGVerifier.prototype.send=function(){if(this.lastKeyTimeStamp!=0){if((new Date().getTime()-this.lastKeyTimeStamp)<this.timeRange){this.notify({KEY:this.lastKey});
this.onUpdate();
return
}}WGGVerifier.superClass.send.call(this)
};
WGGVerifier.prototype.update=function(){this.debugInterface.debug("WGGVerifier.update");
if(arguments.length==0){return
}var xmlDoc=arguments[0];
if(xmlDoc==null){return
}this.debugInterface.debug(xmlDoc);
try{var getkeyNode=xmlDoc.getElementsByTagName("GETKEY")[0];
if(!getkeyNode){this.debugInterface.warn("getkeyNode must not be null or undefined");
return
}var statusNode=getkeyNode.getElementsByTagName("STATUS")[0];
if(statusNode){var status=statusNode.firstChild.nodeValue;
if(status!="OK"){throw"verifier doesnt return OK on requesting a key"
}var keyNode=getkeyNode.getElementsByTagName("KEY")[0];
this.lastKey=keyNode.firstChild.nodeValue;
this.debugInterface.debug("lastKey: "+this.lastKey);
this.lastKeyTimeStamp=new Date().getTime();
if(isOpera){this.ajaxLoader.initialize()
}this.notify({KEY:this.lastKey})
}this.onUpdate()
}catch(e){this.debugInterface.error("error while processing xmlDoc, xmlDoc is probably not a XMLDocument-instance, see description:");
this.debugInterface.error(e)
}};
if(typeof WGG_VERSIONS=="undefined"){var WGG_VERSIONS=[]
}WGG_VERSIONS.push("JSCoreGeneral 1.2-SNAPSHOT;Revision 2375");
var COMMONS={version:1.24,userAgent:navigator.userAgent.toLowerCase()};
COMMONS.isIE=COMMONS.userAgent.indexOf("msie")>-1;
COMMONS.isOpera=COMMONS.userAgent.indexOf("opera")>-1;
COMMONS.isSafari=(!COMMONS.isOpera&&COMMONS.userAgent.indexOf("safari")>-1);
COMMONS.isGecko=(!COMMONS.isOpera&&!COMMONS.isSafari&&COMMONS.userAgent.indexOf("gecko")>-1);
COMMONS.isWin32=(COMMONS.userAgent.indexOf("windows")>-1);
COMMONS.isMacOs=(COMMONS.userAgent.indexOf("mac")>-1);
COMMONS.returnFalse=function returnFalse(){return false
};
COMMONS.returnTrue=function returnTrue(){return true
};
COMMONS.proxy=function(aValue){return aValue
};
COMMONS.isObject=function(anObject){return anObject!==null&&typeof(anObject)==="object"
};
COMMONS.isArray=function(anObject){return anObject instanceof Array
};
COMMONS.isRegExp=function(anObject){return anObject instanceof RegExp
};
COMMONS.isDate=function(anObject){return anObject instanceof Date
};
COMMONS.isNumber=function(anObject){return typeof(anObject)==="number"
};
COMMONS.isBoolean=function(anObject){return typeof(anObject)==="boolean"
};
COMMONS.isString=function(anObject){return typeof(anObject)==="string"
};
COMMONS.isFunction=function(anObject){return typeof(anObject)==="function"
};
COMMONS.isUndefined=function(anObject){return anObject===undefined
};
COMMONS.isDefined=function(anObject){return anObject!==null&&anObject!==undefined
};
COMMONS.toInteger=function(aValue){var result=0;
if(aValue){result=this.isNumber(aValue)?aValue:parseInt(aValue,10)
}return result
};
COMMONS.toFloat=function(aValue){var result=0;
if(aValue){result=this.isNumber(aValue)?aValue:parseFloat(aValue)
}return result
};
COMMONS.BOOLEAN_TRUE={"true":true,yes:true,ok:true};
COMMONS.toBoolean=function(aValue){var result=false;
if(aValue){result=this.isBoolean(aValue)?aValue:this.BOOLEAN_TRUE[aValue.toString().toLowerCase()]
}return result
};
function Logger(aPrefix){this.fPrefix=aPrefix
}Logger.TRACE=20;
Logger.DEBUG=50;
Logger.INFO=70;
Logger.WARN=80;
Logger.ERROR=90;
Logger.FATAL=100;
Logger.prototype.trace=function(aMessage,anException){this.log(Logger.TRACE,aMessage,anException)
};
Logger.prototype.debug=function(aMessage,anException){this.log(Logger.DEBUG,aMessage,anException)
};
Logger.prototype.info=function(aMessage,anException){this.log(Logger.INFO,aMessage,anException)
};
Logger.prototype.warning=function(aMessage,anException){this.log(Logger.WARN,aMessage,anException)
};
Logger.prototype.error=function(aMessage,anException,aMethod){this.log(Logger.ERROR,aMessage,anException,aMethod)
};
Logger.prototype.fatal=function(aMessage,anException,aMethod){this.log(Logger.FATAL,aMessage,anException,aMethod)
};
Logger.prototype.log=function(aType,aMessage,anException,aMethod){var txt=COMMONS.isDefined(this.fPrefix)?"["+this.fPrefix+"] "+aMessage:aMessage;
if(COMMONS.isDefined(anException)){txt+=": "+anException.name+", "+anException.message
}if(COMMONS.isDefined(aMethod)){txt+="\n"+aMethod.toString()
}this.printLog(aType,txt)
};
Logger.prototype.printLog=function(aType,aMessage){if(aType>Logger.WARN){throw new Error(aMessage)
}};
COMMONS.fLogger=new Logger("Common");
var JSINER={scriptPrefix:"script/",scriptSuffix:".js",version:1};
JSINER.fDependency={};
JSINER.fClassMap={};
JSINER.fLogger=new Logger("JSINER");
JSINER.getConstructor=function(anObject){var result=null;
if(COMMONS.isString(anObject)){result=window[anObject]
}else{if(COMMONS.isFunction(anObject)){result=anObject
}else{if(COMMONS.isObject(anObject)){result=anObject.constructor
}}}return result
};
JSINER.getType=function(anObject){var result=(typeof anObject);
if(COMMONS.isObject(anObject)){if(COMMONS.isRegExp(anObject)){result="RegExp"
}else{var constr=this.getConstructor(anObject);
if(COMMONS.isDefined(constr)){var cons=constr.toString();
var index=cons.indexOf("(");
result=((index>0)?cons.substring(cons.indexOf(" ")+1,index):cons);
if(this.fClassMap[result]!==undefined){result=this.fClassMap[result]
}else{if(window[result]===undefined){for(var name in window){var wObj=null;
try{wObj=window[name]
}catch(e){continue
}if(wObj===constr){this.fClassMap[result]=name;
result=name;
break
}}}}}}}return result
};
JSINER.getScriptURI=function(aURL){var result=null;
if(COMMONS.isString(aURL)){result=this.scriptPrefix;
if(/js[i|o]ner/.test(aURL)){result+=aURL
}else{result+=aURL.replace(/[.]/g,"/")
}result=Transporter.addParameter(result+this.scriptSuffix,"ver",this.version)
}return result
};
JSINER.isScriptLoaded=function(aKey){var result=this.fScripts.isContains(aKey);
if(!result){var uri=this.getScriptURI(aKey);
var index=uri.indexOf("?");
if(index>0){uri=uri.substring(0,index)
}var scripts=document.getElementsByTagName("script");
for(var i=0;
i<scripts.length;
i++){var src=scripts[i].src;
if(src.indexOf(uri)>=0){result=true;
break
}}}this.fLogger.info("The script ["+aKey+"] are "+(result?"loaded":"not loaded"));
return result
};
JSINER.setDependency=function(aJson){this.fDependency=COMMONS.isDefined(aJson)?aJson:{}
};
JSINER.addDependency=function(aJson){if(COMMONS.isDefined(aJson)){for(var name in aJson){var dependency=this.fDependency[name];
if(!COMMONS.isArray(dependency)){this.fDependency[name]=[];
dependency=this.fDependency[name]
}var value=aJson[name];
if(COMMONS.isArray(value)){for(var i=0;
i<value.length;
i++){dependency.push(value[i])
}}else{dependency.push(value)
}}}};
JSINER.getDependency=function(anObject,aClass){var type=this.getType(anObject);
return this.fDependency[type]
};
JSINER.createInstance=function(aConstructor,aClass){var result=null;
if(COMMONS.isFunction(aConstructor)&&COMMONS.isFunction(aClass)&&aClass!==Object){var oldPrototype=aConstructor.prototype;
var oldToString=aConstructor.prototype.toString;
if(!window.__jsinerPrototypes){window.__jsinerPrototypes=[]
}window.__jsinerPrototypes.push(new aClass());
aConstructor.prototype=window.__jsinerPrototypes[window.__jsinerPrototypes.length-1];
aConstructor.prototype.constructor=aConstructor;
if(!aConstructor.superClass){aConstructor.superClass=aClass.prototype
}if(!aConstructor.superClasses){aConstructor.superClasses=[]
}aConstructor.superClasses.push(aClass.prototype);
for(var name in oldPrototype){aConstructor.prototype[name]=oldPrototype[name]
}aConstructor.prototype.toString=oldToString;
var aClassName=JSINER.getClassName(aClass);
var extendTagName="$extend"+aClassName;
aConstructor[extendTagName]=true;
result=new aConstructor()
}return result
};
JSINER.getClassName=function(aClass){if(COMMONS.isString(aClass)){return aClass
}var aClassStr=new String(aClass);
var bodyPos=aClassStr.indexOf("{");
if(bodyPos==-1){return""
}aClassStr=aClassStr.substring(0,bodyPos);
var MethodRegExp=function(){return new RegExp("(function)( [a-zA-Z0-9_]+)?(.*)","g")
};
var matches=new MethodRegExp().exec(aClassStr);
if(!matches){return""
}if(matches.length<3){return""
}if(typeof matches[2]=="undefined"){return""
}return matches[2].replace(/^\s+/,"").replace(/\s+$/,"")
};
JSINER.extend=function(anObject,aClass){var doExtend=function(anObject,aClass){var result=anObject;
var cons=anObject.constructor;
var aClassName=JSINER.getClassName(aClass);
var extendTagName="$extend"+aClassName;
if(COMMONS.isUndefined(cons[extendTagName])){var dependency=this.getDependency(anObject,aClass);
if(COMMONS.isArray(dependency)){var toolkit=this;
this.inject(dependency,function(){var inheritClass=toolkit.getConstructor(aClass);
result=toolkit.createInstance(cons,inheritClass)||result;
toolkit=null
})
}else{var inheritClass=this.getConstructor(aClass);
result=this.createInstance(cons,inheritClass)||result
}}return result
};
var result=doExtend.call(this,anObject,aClass);
var inheritClass=this.getConstructor(aClass);
if(COMMONS.isFunction(inheritClass)){inheritClass.call(result)
}return result
};
JSINER.finalize=function(){if(arguments.length==0){return 0
}var anObject=arguments[0];
var finalizedCount=0;
var aConstructor=anObject.constructor;
if(!aConstructor){return 0
}if(aConstructor.superClass){aConstructor.superClass=null;
delete aConstructor.superClass;
finalizedCount++
}if(aConstructor.superClasses){while(aConstructor.superClasses.length>0){var sClass=aConstructor.superClasses.pop();
if(sClass==null){continue
}sClass=null;
finalizedCount++
}aConstructor.superClasses=null;
delete aConstructor.superClasses;
finalizedCount++
}return finalizedCount
};
JSINER.INTERCEPT_BEFORE=0;
JSINER.INTERCEPT_AFTER=1;
JSINER.INTERCEPT_INSTEAD=2;
JSINER.INTERCEPT_ON_ERROR=3;
JSINER.fMethods=new HashMap();
JSINER.registerInterceptor=function(aClass,aMethodName,aType,aMethod){var constr=this.getConstructor(aClass);
if(constr!==null&&COMMONS.isFunction(aMethod)){var key=this.getType(constr)+"."+aMethodName;
var oldMethod=constr.prototype[aMethodName];
if(!this.fMethods.isContains(key)){this.fMethods.put(key,oldMethod)
}if(this.isUndefined(oldMethod)){aType=this.INTERCEPT_INSTEAD
}var newFunction=null;
switch(aType){case this.INTERCEPT_BEFORE:newFunction=function(){aMethod.apply(this,arguments);
return oldMethod.apply(this,arguments)
};
break;
case this.INTERCEPT_AFTER:newFunction=function(){var result=oldMethod.apply(this,arguments);
aMethod.apply(this,arguments);
return result
};
break;
case this.INTERCEPT_INSTEAD:newFunction=function(){var result=aMethod.apply(this,arguments);
return result
};
break;
case this.INTERCEPT_ON_ERROR:newFunction=function(){var result=null;
try{result=oldMethod.apply(this,arguments)
}catch(ex){result=aMethod.apply(this,arguments)
}return result
};
break;
default:this.fLogger.error("register interceptor, unsupported type "+aType);
break
}constr.prototype[aMethodName]=newFunction
}else{this.fLogger.error("register interceptor, unsupported arguments "+aClass)
}};
JSINER.unregisterInterceptor=function(aClass,aMethodName){var constr=this.getConstructor(aClass);
if(constr!==null){var key=this.getType(constr)+"."+aMethodName;
if(this.fMethods.isContains(key)){constr.prototype[aMethodName]=this.fMethods.get(key);
this.fMethods.remove(key)
}else{this.fLogger.warning("unregister interceptor, "+key+" never was registered.")
}}else{this.fLogger.error("unregister interceptor, unable to obtain object constructor "+aClass)
}};
JSINER.getInfo=function(anObject,anAttributesOnly){var result=typeof(anObject);
if(COMMONS.isObject(anObject)){result+="["+this.getType(anObject)+"]\n";
if(!anAttributesOnly){var properties=[];
var value;
for(var name in anObject){try{value=anObject[name];
properties.push(COMMONS.isFunction(value)?(name+"()"):(name+"="+value))
}catch(ex){properties.push(name)
}}if(properties.length>0){result+=properties.sort().join(", ")
}}if(COMMONS.isArray(Object.attributes)){var attributes=[];
var attribute;
try{for(var j=0;
j<anObject.attributes.length;
j++){attribute=anObject.attributes[j];
if(attribute.nodeValue!==null&&attribute.nodeValue!==""){attributes.push(attribute.name+"="+attribute.nodeValue)
}}}catch(ex){}if(attributes.length>0){result+="\n ["+attributes.sort().join(", ")+"]"
}}}return result
};
function HashMap(anObject){this.fObject=anObject||{};
this.fSize=0;
for(var name in this.fObject){if(this.fObject.hasOwnProperty(name)){this.fSize++
}}}HashMap.prototype.isEmpty=function(){return this.getSize()===0
};
HashMap.prototype.getSize=function(){return this.fSize
};
HashMap.prototype.get=function(aKey){return this.fObject[aKey]
};
HashMap.prototype.isContains=function(aKey){return COMMONS.isDefined(this.get(aKey))
};
HashMap.prototype.put=function(aKey,aValue){if(!this.isContains(aKey)){this.fSize++
}this.fObject[aKey]=aValue
};
HashMap.prototype.remove=function(aKey){if(this.isContains(aKey)){this.fObject[aKey]=undefined;
delete this.fObject[aKey];
if(!this.isContains(aKey)){this.fSize--
}}};
HashMap.prototype.clear=function(){this.fSize=0;
this.fObject={}
};
function KeySet(){var self=JSINER.extend(this,HashMap);
for(var i=0;
i<arguments.length;
i++){self.add(arguments[i])
}return self
}KeySet.prototype.add=function(aKey){KeySet.superClass.put.call(this,aKey,true)
};
KeySet.prototype.getSize=function(){return this.fSize
};
JSINER.fScripts=new KeySet();
COMMONS.isEquals=function(anObject1,anObject2){function isObjectEquals(anObject1,anObject2){var result=true;
var set=new KeySet();
for(var name in anObject1){if(anObject1.hasOwnProperty(name)){if(!COMMONS.isEquals(anObject1[name],anObject2[name])){result=false;
break
}set.add(name)
}}for(var name in anObject2){if(anObject2.hasOwnProperty(name)&&!set.isContains(name)){if(!COMMONS.isEquals(anObject1[name],anObject2[name])){result=false;
break
}}}return result
}var result=JSINER.getType(anObject1)===JSINER.getType(anObject2);
if(result){if(COMMONS.isObject(anObject1)){if(!isNaN(anObject1.nodeType)){result=COMMONS.isString(anObject1.id);
if(result){result=anObject1.nodeType===anObject2.nodeType&&anObject1.nodeName===anObject2.nodeName&&anObject1.id===anObject2.id
}}else{if(COMMONS.isArray(anObject1)){result=(anObject1.length===anObject2.length)
}if(result){result=isObjectEquals(anObject1,anObject2)
}}}else{result=(anObject1===anObject2)
}}return result
};
function Transporter(anOnLoad,aTaskID,aMethod,aCounter,anAsynch){this.fAsynch=COMMONS.isBoolean(anAsynch)?anAsynch:true;
this.fTaskID=aTaskID;
this.fCounter=COMMONS.isNumber(aCounter)?Math.max(aCounter,0):1;
this.fMethod=aMethod;
this.onLoad=anOnLoad;
this.fTimeout=1000;
this.fURI=null;
this.fQueryString=null;
this.fTaskCounter=this.fCounter;
this.fReq=null;
this.fReqTaskID=null;
this.fResponseHandlers=new HashMap();
this.registerDefaults()
}Transporter.fTaskSet=new KeySet();
Transporter.setTaskAlive=function(aTaskID,anAlive){if(COMMONS.isDefined(aTaskID)){if(anAlive){Transporter.fTaskSet.add(aTaskID)
}else{Transporter.fTaskSet.remove(aTaskID)
}}};
Transporter.isLoaderAlive=function(aTaskID){var result=!Transporter.fTaskSet.isEmpty();
return result
};
Transporter.isTaskAlive=function(aTaskID){var result=false;
if(COMMONS.isDefined(aTaskID)){result=Transporter.fTaskSet.isContains(aTaskID)
}return result
};
Transporter.addParameter=function(aURL,aParamName,aValue){var result=aURL;
if(COMMONS.isString(aURL)&&COMMONS.isString(aParamName)&&COMMONS.isDefined(aValue)){var prefix=aParamName+"=";
var index=aURL.indexOf(prefix);
if(index>0){result=aURL.substring(0,index+prefix.length)+aValue;
var lastIndex=aURL.indexOf("&",index+prefix.length);
if(lastIndex>0){result+=aURL.substring(lastIndex,aURL.length)
}}else{result+=(result.indexOf("?")>0)?"&":"?";
result+=prefix+aValue
}}return result
};
Transporter.ActiveX_TRANSPORT=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0"];
Transporter.prototype.fLogger=new Logger("Transporter");
Transporter.prototype.getQueryString=function(anArray,aIndex){var result=null;
var index=COMMONS.isNumber(aIndex)?Math.max(aIndex,0):0;
if(COMMONS.isArray(anArray)&&anArray.length>=index){result=anArray[index];
if(anArray.length>=index){for(var i=index+1;
i<anArray.length;
i++){result+=((i%2===1)?"=":"&")+anArray[i]
}}}return result
};
Transporter.prototype.getDefaultHandler=function(){return this.errorHandler()
};
Transporter.prototype.getResponseHandler=function(aStatusCode){var result=this.fResponseHandlers.get(aStatusCode);
if(!COMMONS.isDefined(result)){result=this.getDefaultHandler()
}return result
};
Transporter.prototype.registerDefaults=function(){this.setResponseHandeler(400,this.fatalErrorHandler);
this.setResponseHandeler(500,this.fatalErrorHandler);
this.setResponseHandeler(0,this.okHandler);
this.setResponseHandeler(200,this.okHandler)
};
Transporter.prototype.setResponseHandeler=function(aStatusCode,aHandler){this.fResponseHandlers.put(aStatusCode,aHandler)
};
Transporter.prototype.customizeHeaders=function(aRequest){var contentType=(this.fMethod==="POST")?'application/x-www-form-urlencoded;charset="utf-8"':'text/xml;charset="utf-8"';
aRequest.setRequestHeader("Content-type",contentType);
if(COMMONS.isGecko){aRequest.setRequestHeader("Connection","close")
}};
Transporter.prototype.request=function(aURI,aMethod,aQuery){this.fURI=aURI;
this.fTaskCounter=this.fCounter;
this.fQueryString=aQuery;
this.fMethod=aMethod;
Transporter.setTaskAlive(this.fTaskID,true);
try{this.doLoadData()
}catch(ex){this.fLogger.warning("doLoadData error happened",ex)
}};
Transporter.prototype.sendData=function(aURI){var query=this.getQueryString(arguments,1);
this.request(aURI,"POST",query)
};
Transporter.prototype.loadData=function(aURI){var query=this.getQueryString(arguments,1);
this.request(aURI,"GET",query)
};
Transporter.prototype.doLoadData=function(){if(window.XMLHttpRequest){this.fReq=new XMLHttpRequest()
}else{if(window.ActiveXObject){if(COMMONS.isDefined(Transporter.ActiveX_TRANSPORT.transport)){this.fReq=new ActiveXObject(Transporter.ActiveX_TRANSPORT.transport)
}else{var value;
for(var i=0;
i<Transporter.ActiveX_TRANSPORT.length;
i++){value=Transporter.ActiveX_TRANSPORT[i];
try{this.fReq=new ActiveXObject(value);
Transporter.ActiveX_TRANSPORT.transport=value;
break
}catch(ex){}}}}}if(COMMONS.isDefined(this.fReq)){this.fProcessed=false;
var transport=this;
this.fReq.onreadystatechange=function(){transport.onReadyState.call(transport)
};
try{this.fReq.open(this.fMethod,this.fURI,this.fAsynch);
this.customizeHeaders(this.fReq);
this.fReq.send(this.fQueryString);
this.fLogger.info("Open request: "+this.fURI+(this.fQueryString?"?"+this.fQueryString:""));
if(!this.fAsynch&&COMMONS.isGecko&&this.fReq.readyState===4){this.onReadyState()
}}catch(ex){this.fatalErrorHandler()
}}else{this.fLogger.error("Browser not supported XMLHttpRequest")
}};
Transporter.prototype.onReadyState=function(){var ready=this.fReq.readyState;
if(ready===4){if(!this.fProcessed){var handler=this.getResponseHandler(this.fReq.status);
handler.call(this);
this.fReq.onreadystatechange=COMMONS.returnTrue;
this.fProcessed=true
}}};
Transporter.prototype.okHandler=function(){this.fLogger.info("Request successfully: "+this.fURI);
if(COMMONS.isFunction(this.onLoad)){try{this.onLoad.call(this)
}catch(ex){this.fLogger.error("Callback error: "+this.fURI,ex,this.onLoad)
}}Transporter.setTaskAlive(this.fTaskID,false)
};
Transporter.prototype.fatalErrorHandler=function(){if(this.fReqTaskID!==null){window.clearTimeout(this.fReqTaskID);
this.fReqTaskID=null
}Transporter.setTaskAlive(this.fTaskID,false);
if(COMMONS.isDefined(this.fReq)){this.fLogger.error(this.fReq.status+", request "+this.fURI+" error. Headers: "+this.fReq.getAllResponseHeaders());
this.fReq.onreadystatechange=COMMONS.returnTrue;
this.fReq.abort()
}};
Transporter.prototype.errorHandler=function(){if(this.fReqTaskID!==null){window.clearTimeout(this.fReqTaskID);
this.fReqTaskID=null
}if(this.fTaskCounter<=0){Transporter.setTaskAlive(this.fTaskID,false);
this.fLogger.error(this.fReq.status+", request  "+this.fURI+" error. Headers: "+this.fReq.getAllResponseHeaders())
}else{var transporter=this;
this.fTaskCounter=this.fTaskCounter-1;
this.fReqTaskID=window.setTimeout(function(){transporter.doLoadData()
},this.fTimeout);
this.fLogger.info(this.fReq.status+", trying to request "+this.fURI+" again....")
}};
Transporter.prototype.getResponsedText=function(){var result=null;
if(COMMONS.isDefined(this.fReq)){result=this.fReq.responseText
}return result
};
Transporter.prototype.getResponsedXML=function(){var result=null;
if(COMMONS.isDefined(this.fReq)){try{result=this.fReq.responseXML
}catch(ex){this.fLogger.error("Unable to parse responsed XML",ex)
}}return result
};
JSINER.inject=function(aDependency,aCallBack){var getUri=function(aLoader,aDependency){var result=null;
for(var i=aLoader.fIndex;
i<aDependency.length;
i++){var link=aDependency[aLoader.fIndex];
if(!JSINER.isScriptLoaded(link)){result=JSINER.getScriptURI(link);
if(result!==null){aLoader.fIndex=i;
break
}}}return result
};
if(COMMONS.isDefined(aDependency)){if(!COMMONS.isArray(aDependency)){aDependency=[aDependency]
}var loader=new Transporter(function(){var code=this.getResponsedText();
if(window.execScript){window.execScript(code,"javascript")
}else{if(COMMONS.isSafari){var heads=document.getElementsByTagName("head");
var head=heads.length>0?heads[0]:document.body;
var script=document.createElement("script");
script.type="text/javascript";
script.innerHTML=code;
head.appendChild(script)
}else{window.eval(code)
}}JSINER.fScripts.add(aDependency[this.fIndex]);
this.fIndex++;
var uri=getUri(this,aDependency);
if(uri!==null){this.loadData(uri)
}else{if(COMMONS.isFunction(aCallBack)){aCallBack()
}}});
loader.fAsynch=false;
loader.fIndex=0;
var uri=getUri(loader,aDependency);
if(uri!==null){loader.loadData(uri)
}else{if(COMMONS.isFunction(aCallBack)){aCallBack()
}}}};
var JSONER={version:1.024};
function Jsoner(){this.fDataProviderCache=new HashMap();
this.fLogger=new Logger("Jsoner");
this.isWalkArray=function(aName,aValue,aJson){return COMMONS.isArray(aValue)
};
this.isWalkNode=function(aName,aValue,aJson){return COMMONS.isObject(aValue)&&!COMMONS.isDate(aValue)&&!COMMONS.isRegExp(aValue)
}
}Jsoner.JSON_NODE_START=1;
Jsoner.JSON_NODE_END=2;
Jsoner.JSON_NODE_LEAF=3;
Jsoner.JSON_ATTRIBUTE=4;
Jsoner.JSON_NODE_CROSS_LINKED=5;
Jsoner.MAGIC_HASH_CODE="$lnk";
Jsoner.CROSS_LINK_PREFIX="#link:";
Jsoner.prototype.isMatch=function(aPattern,aValue){var result=false;
if(COMMONS.isDefined(aPattern)){var string=String(aValue);
if(COMMONS.isRegExp(aPattern)){result=aPattern.test(string)
}else{if(COMMONS.isString(aPattern)){var index=aPattern.indexOf("*");
if(index===-1){result=(aValue===aPattern)
}else{if(index===0){if(aPattern.length>1){var tmp=aPattern.substr(1);
result=string.lastIndexOf(tmp)===(string.length-tmp.length)
}}else{var tokens=aPattern.split("*");
result=string.indexOf(tokens[0])===0;
if(result&&tokens.length>1){var lastToken=tokens[tokens.length-1];
result=string.lastIndexOf(lastToken)===(string.length-lastToken.length)
}}}}}}return result
};
Jsoner.prototype.converterFactory=function(aConverter){var result=COMMONS.proxy;
if(COMMONS.isFunction(aConverter)){result=aConverter
}else{if(COMMONS.isObject(aConverter)){result=function(aValue){for(var name in aConverter){if(aConverter.hasOwnProperty(name)&&this.isMatch(name,aValue)){return aConverter[name]
}}return aValue
}
}}return result
};
Jsoner.prototype.populate=function(aJson,aPath,aValue,aCreateMissing){function parseSegment(aSegment){var result=aSegment;
if(aSegment.charAt(aSegment.length-1)==="]"){var index=aSegment.indexOf("[");
result={path:aSegment.substring(0,index),index:aSegment.substring(index+1,aSegment.length-1)}
}return result
}var path=aPath.split(".");
var obj=aJson;
var tmpObj;
var segment;
for(var i=0;
(i<path.length-1)&&(obj!==null);
i++){segment=parseSegment(path[i]);
if(COMMONS.isString(segment)){tmpObj=obj[segment];
if(aCreateMissing){if(!COMMONS.isDefined(tmpObj)){tmpObj={};
obj[segment]=tmpObj
}else{if(COMMONS.isArray(tmpObj)&&!COMMONS.isDefined(tmpObj[0])){tmpObj[0]={}
}}}obj=COMMONS.isArray(tmpObj)?tmpObj[0]:tmpObj
}else{tmpObj=obj[segment.path];
if(!COMMONS.isDefined(tmpObj)&&aCreateMissing){tmpObj=[];
obj[segment.path]=tmpObj
}else{if(!COMMONS.isArray(tmpObj)){tmpObj=[tmpObj];
obj[segment.path]=tmpObj
}}obj=tmpObj;
if(COMMONS.isDefined(obj)){tmpObj=obj[segment.index];
if(!COMMONS.isDefined(tmpObj)&&aCreateMissing){tmpObj={};
obj[segment.index]=tmpObj
}obj=tmpObj
}}}if(COMMONS.isDefined(obj)){segment=parseSegment(path[path.length-1]);
if(COMMONS.isString(segment)){obj[segment]=aValue
}else{tmpObj=obj[segment.path];
if(!COMMONS.isDefined(tmpObj)){tmpObj=[];
obj[segment.path]=tmpObj
}else{if(!COMMONS.isArray(tmpObj)){tmpObj=[tmpObj];
obj[segment.path]=tmpObj
}}tmpObj[segment.index]=aValue
}}return aJson
};
Jsoner.prototype.registerDataProvider=function(aPath,aFunction){this.fDataProviderCache.put(aPath,aFunction)
};
Jsoner.prototype.getValue=function(aJson,aPath){var result=undefined;
if(COMMONS.isObject(aJson)){try{result=aJson[aPath];
if(COMMONS.isUndefined(result)){var fnc=this.fDataProviderCache.get(aPath);
if(!COMMONS.isFunction(fnc)){var fncBody="return aData";
if(aPath.length>0){if(aPath.charAt(0)==="["){fncBody+=aPath
}else{fncBody+="."+aPath
}}fnc=new Function("aData",fncBody);
this.registerDataProvider(aPath,fnc)
}result=fnc.call(this,aJson)
}}catch(ex){}}return result
};
Jsoner.prototype.setValue=function(aJson,aPath,aValue,aCreateMissing){var result=aJson;
if(COMMONS.isObject(aJson)){var createMissing=(COMMONS.isUndefined(aCreateMissing)||aCreateMissing);
this.populate(aJson,aPath,aValue,createMissing)
}return result
};
Jsoner.prototype.isMute=function(aName,aValue,aParent){var result=aName===Jsoner.MAGIC_HASH_CODE||!aParent.hasOwnProperty(aName)||COMMONS.isFunction(aValue);
return result
};
Jsoner.prototype.isAttribute=function(aName,aValue){var result=true;
if(aValue===null||COMMONS.isObject(aValue)){result=COMMONS.isDate(aValue)||COMMONS.isRegExp(aValue)||aValue===null
}return result
};
Jsoner.prototype.isText=function(anAttributeName){return(anAttributeName==="text")
};
Jsoner.prototype.isCDATA=function(anAttributeName){return(anAttributeName==="PCDATA")
};
Jsoner.prototype.collectAttributes=function(aPath,aValue,aJson){var result=[];
var value;
if(COMMONS.isObject(aValue)){for(var name in aValue){try{value=aValue[name];
if(!this.isMute(name,value,aValue)&&this.isAttribute(name,value)){result.push({name:name,value:value})
}}catch(ex){this.fLogger.warning("collectAttributes, unable to collect attribute:"+name,ex)
}}}return result
};
Jsoner.prototype.collectChildren=function(aPath,aValue,aJson){var result=[];
var value;
for(var name in aValue){try{value=aValue[name];
if(!this.isMute(name,value,aValue)&&!this.isAttribute(name,value)){result.push({name:name,value:value})
}}catch(ex){this.fLogger.warning("collectChildren, unable to collect child:"+name,ex)
}}return result
};
Jsoner.prototype.isResolveCrossLinks=function(anObject){return true
};
Jsoner.prototype.addHashCode=function(anObject,aValue){if(COMMONS.isObject(anObject)){anObject[Jsoner.MAGIC_HASH_CODE]=aValue
}};
Jsoner.prototype.getHashCode=function(anObject){var result=undefined;
if(COMMONS.isObject(anObject)){result=anObject[Jsoner.MAGIC_HASH_CODE]
}return result
};
Jsoner.prototype.removeHashCode=function(anObject){if(COMMONS.isObject(anObject)&&anObject[Jsoner.MAGIC_HASH_CODE]!==undefined){anObject[Jsoner.MAGIC_HASH_CODE]=undefined;
delete anObject[Jsoner.MAGIC_HASH_CODE]
}};
Jsoner.prototype.jsonTreeWalker=function(aJson,aCallBack){var level=-1;
var path=[];
var result=true;
var map=new HashMap();
function walkNode(aName,aValue,aLevel,aIndex){var attributes,index,value;
if(result){if(this.isWalkArray(path,aValue,aJson)){for(var i=0;
i<aValue.length&&result;
i++){walkNode.call(this,aName,aValue[i],aLevel,i)
}}else{var currentPath=COMMONS.isDefined(aIndex)?aName+"["+aIndex+"]":aName;
if(aLevel>level){path.push(currentPath);
level=aLevel
}else{path[aLevel]=currentPath
}if(this.isWalkNode(path,aValue,aJson)){try{attributes=this.collectAttributes(path,aValue,aJson);
index=this.getHashCode(aValue);
if(COMMONS.isUndefined(index)){if(this.isResolveCrossLinks(aValue)){index=map.getSize();
this.addHashCode(aValue,index);
map.put(index,aName)
}try{var children=this.collectChildren(path,aValue,aJson);
if(children.length>0){try{result=aCallBack.call(this,path,aValue,attributes,Jsoner.JSON_NODE_START,aLevel,aIndex)
}catch(ex){this.fLogger.error("jsonTreeWalker, ["+path+"] call back error",ex)
}if(result){for(var i=0;
i<children.length&&result;
i++){walkNode.call(this,children[i].name,children[i].value,aLevel+1,null)
}path.pop();
level--;
result=aCallBack.call(this,path,aValue,null,Jsoner.JSON_NODE_END,aLevel,aIndex)
}}else{try{result=aCallBack.call(this,path,aValue,attributes,Jsoner.JSON_NODE_LEAF,aLevel,aIndex)
}catch(ex){this.fLogger.error("jsonTreeWalker, ["+path+"] call back error",ex)
}}}finally{this.removeHashCode(aValue)
}}else{value=map.get(index);
try{result=aCallBack.call(this,path,value,attributes,Jsoner.JSON_NODE_CROSS_LINKED,aLevel,aIndex)
}catch(ex){this.fLogger.error("jsonTreeWalker, ["+path+"] call back error",ex)
}}}catch(exception){this.fLogger.error("jsonTreeWalker, traverse node "+aName+" failed",exception)
}}else{result=aCallBack.call(this,path,aValue,null,Jsoner.JSON_ATTRIBUTE,aLevel,aIndex)
}}}}if(COMMONS.isFunction(aCallBack)){if(this.isWalkArray([],aJson,aJson)){walkNode.call(this,"",aJson,0)
}else{var value;
for(var name in aJson){try{value=aJson[name];
if(!this.isMute(name,value,aJson)){walkNode.call(this,name,value,0)
}}catch(ex){this.fLogger.info("jsonTreeWalker, unable to walk object property: "+name,ex)
}}}map.clear()
}else{this.fLogger.error("jsonTreeWalker, callback function undefined")
}};
Jsoner.prototype.getLastProperty=function(aPath){var result=undefined;
if(COMMONS.isArray(aPath)){result=aPath[aPath.length-1];
if(result.charAt(result.length-1)==="]"){var index=result.indexOf("[");
if(index>0){result=result.substring(0,index)
}}}return result
};
Jsoner.prototype.jsonToXML=function(aJson,aPrettyPrint,aNodeConverter,anAttributeConverter,aValueConverter){var getPrettyPrintTab=function(aLevel){var result="";
for(var i=0;
i<aLevel;
i++){result+=" "
}return result
};
var atttibuteValueConverter=function(aValue,aName,aPath,aType){var result=aValue;
if(aType===Jsoner.JSON_NODE_CROSS_LINKED){result=Jsoner.CROSS_LINK_PREFIX+result
}return result
};
var result="";
var nodeConverter=this.converterFactory(aNodeConverter);
var attributeConverter=this.converterFactory(anAttributeConverter);
var valueConverter=this.converterFactory(aValueConverter?aValueConverter:atttibuteValueConverter);
this.jsonTreeWalker(aJson,function(aPath,aValue,anAttributes,aType){var value;
var name;
var attribute;
var nodeName=nodeConverter.call(this,this.getLastProperty(aPath),aPath,aType);
if(COMMONS.isDefined(nodeName)){if(aPrettyPrint){result+=getPrettyPrintTab(aPath.length-1)
}if(aType===Jsoner.JSON_NODE_START||aType===Jsoner.JSON_NODE_LEAF){var CDATA="";
var text="";
result+="<"+nodeName;
if(COMMONS.isArray(anAttributes)){for(var i=0;
i<anAttributes.length;
i++){attribute=anAttributes[i];
name=attribute.name;
value=valueConverter.call(this,attribute.value,name,aPath,aType);
if(!COMMONS.isUndefined(value)){name=attributeConverter.call(this,name,value,aPath);
if(COMMONS.isDefined(name)){if(this.isText(name)){text+=value
}else{if(this.isCDATA(name)){CDATA+=value
}else{result+=" "+name+'="'+value+'"'
}}}}}}if(CDATA.length>0||text.length>0){result+=">";
if(aPrettyPrint){result+="\n"+getPrettyPrintTab(aPath.length)
}result+=(CDATA.length>0)?"<![CDATA["+CDATA+text+"]]>":text;
if(aType===Jsoner.JSON_NODE_LEAF){if(aPrettyPrint){result+="\n"+getPrettyPrintTab(aPath.length-1)
}result+="</"+nodeName+">"
}}else{result+=(aType===Jsoner.JSON_NODE_LEAF)?"/>":">"
}}else{if(aType===Jsoner.JSON_NODE_END){result+="</"+nodeName+">"
}else{if(aType===Jsoner.JSON_ATTRIBUTE||aType===Jsoner.JSON_NODE_CROSS_LINKED){value=valueConverter.call(this,aValue,nodeName,aPath,aType);
if(COMMONS.isDefined(value)){result+="<"+nodeName+">"+value+"</"+nodeName+">"
}}}}if(aPrettyPrint){result+="\n"
}}return true
});
return result
};
Jsoner.prototype.jsonPathEvaluator=function(aJson,aCallBack){var result=true;
this.jsonTreeWalker(aJson,function(aPath,aValue,anAttributes,aType){var attribute;
var value;
if(aType===Jsoner.JSON_NODE_START||aType===Jsoner.JSON_NODE_LEAF||aType===Jsoner.JSON_ATTRIBUTE||aType===Jsoner.JSON_NODE_CROSS_LINKED){var xPath=aPath.join(".");
if(aType===Jsoner.JSON_NODE_CROSS_LINKED){var last=xPath.lastIndexOf(aValue);
value=Jsoner.CROSS_LINK_PREFIX+(last>0?xPath.substring(0,last+aValue.length):aValue);
result=aCallBack.call(this,xPath,value,aType)
}else{if(COMMONS.isArray(anAttributes)){for(var i=0;
i<anAttributes.length;
i++){attribute=anAttributes[i];
result=aCallBack.call(this,xPath+"."+attribute.name,attribute.value,aType);
if(!result){break
}}}else{result=aCallBack.call(this,xPath,aValue,aType)
}}}return result
})
};
Jsoner.prototype.jsonToPathValue=function(aJson){var result="";
this.jsonPathEvaluator(aJson,function(aPath,aValue,aType){result+=aPath+" = "+aValue+"\n";
return true
});
return result
};
Jsoner.prototype.createNewInstance=function(aJson){var result=aJson;
if(COMMONS.isObject(aJson)){var cons=JSINER.getConstructor(aJson);
result=new cons()
}return result
};
Jsoner.prototype.clone=function(aJson){var map=new HashMap();
var doClone=function(json){var result;
var value;
var index=this.getHashCode(json);
if(COMMONS.isUndefined(index)){result=this.createNewInstance(json);
if(this.isResolveCrossLinks(json)){index=map.getSize();
this.addHashCode(json,index);
map.put(index,result)
}try{for(var name in json){value=json[name];
if(!this.isMute(name,value,json)){if(!this.isAttribute(name,value)){index=this.getHashCode(value);
if(COMMONS.isDefined(index)){value=map.get(index)
}else{value=doClone.call(this,value)
}}result[name]=value
}}}finally{this.removeHashCode(json)
}}else{result=map.get(index)
}return result
};
var result=doClone.call(this,aJson,map);
map.clear();
return result
};
Jsoner.prototype.merge=function(aTemplate,aJson,aCreateMissing){var result=this.clone(aTemplate);
var createMissing=(COMMONS.isUndefined(aCreateMissing)||aCreateMissing);
var map=new HashMap();
if(COMMONS.isObject(aJson)&&COMMONS.isObject(aTemplate)){this.jsonPathEvaluator(aJson,function(aPath,aValue,aType){if(aType!==Jsoner.JSON_NODE_CROSS_LINKED){var populate=COMMONS.isUndefined(this.getValue(result,aPath));
if(!populate){var index=aPath.lastIndexOf(".");
if(index>0){var name=aPath.substring(index+1);
populate=this.isAttribute(name,aValue)
}}if(populate){if(COMMONS.isString(aValue)&&aValue.indexOf(Jsoner.CROSS_LINK_PREFIX)===0){map.put(aPath,aValue.substring(Jsoner.CROSS_LINK_PREFIX.length))
}else{this.populate(result,aPath,aValue,createMissing)
}}}else{map.put(aPath,aValue.substring(Jsoner.CROSS_LINK_PREFIX.length))
}return true
});
if(!map.isEmpty()){var value;
for(var name in map.fObject){if(map.fObject.hasOwnProperty(name)){value=this.getValue(result,map.get(name));
this.populate(result,name,value,createMissing)
}}}}return result
};
Jsoner.prototype.isEquals=function(aJson1,aJson2){var isObjectEquals=function(aJson1,aJson2){var result=true;
var crossLinks=new HashMap();
var pathSet=new KeySet();
this.jsonPathEvaluator(aJson1,function(aPath,aValue,aType){if(aType!==Jsoner.JSON_NODE_CROSS_LINKED){if(!this.isEquals(aValue,this.getValue(aJson2,aPath))){this.fLogger.info("isEquals, difference found:"+aPath);
result=false
}else{pathSet.add(aPath)
}}else{crossLinks.put(aPath,aValue)
}return result
});
if(result){this.jsonPathEvaluator(aJson2,function(aPath,aValue,aType){if(!pathSet.isContains(aPath)){if(aType!==Jsoner.JSON_NODE_CROSS_LINKED){if(!this.isEquals(aValue,this.getValue(aJson1,aPath))){this.fLogger.info("isEquals, difference found:"+aPath);
result=false
}}else{if(!this.isEquals(aValue,crossLinks.get(aPath))){this.fLogger.info("isEquals, cross link not equal:"+aPath);
result=false
}else{crossLinks.remove(aPath)
}}}return result
})
}return result&&crossLinks.isEmpty()
};
var result=JSINER.getType(aJson1)===JSINER.getType(aJson2);
if(result){if(COMMONS.isObject(aJson1)){if(COMMONS.isArray(aJson1)){result=(aJson1.length===aJson2.length)
}if(result){result=isObjectEquals.call(this,aJson1,aJson2)
}}else{result=(aJson1===aJson2)
}}return result
};
Jsoner.prototype.getDifference=function(aTemplate,aJson){var parsePath=function(aPath){var result=aPath;
var index=aPath.lastIndexOf("]");
if(index>0&&index<aPath.length-1){var bIndex=aPath.lastIndexOf("[");
result={path:aPath.substring(0,bIndex),index:COMMONS.toInteger(aPath.substring(bIndex+1,index)),property:aPath.substring(index+2)}
}return result
};
var doDifference=function(aTemplate,aJson,aResult){var crossLinks=new HashMap();
var pathSet=new KeySet();
this.jsonPathEvaluator(aTemplate,function(aPath,aValue,aType){if(aType!==Jsoner.JSON_NODE_CROSS_LINKED){pathSet.add(aPath);
if(!this.isEquals(aValue,this.getValue(aJson,aPath))){this.setValue(aResult,aPath,aValue)
}}else{crossLinks.put(aPath,aValue)
}return true
});
this.jsonPathEvaluator(aJson,function(aPath,aValue,aType){if(!pathSet.isContains(aPath)){if(aType!==Jsoner.JSON_NODE_CROSS_LINKED){var value=this.getValue(aTemplate,aPath);
if(!this.isEquals(aValue,value)){var obj=parsePath(aPath);
if(!COMMONS.isString(obj)){var path;
for(var i=0;
i<obj.index;
i++){path=obj.path+"["+i+"]."+obj.property;
this.setValue(aResult,path,this.getValue(aTemplate,path))
}}this.setValue(aResult,aPath,value)
}}else{if(this.isEquals(aValue,crossLinks.get(aPath))){crossLinks.remove(aPath)
}}}return true
});
if(!crossLinks.isEmpty()){for(var name in crossLinks.fObject){if(crossLinks.fObject.hasOwnProperty(name)){this.setValue(aResult,name,crossLinks.fObject[name])
}}}};
var result=aTemplate;
if(COMMONS.isObject(aTemplate)&&COMMONS.isObject(aJson)){result=this.createNewInstance(aTemplate);
doDifference.call(this,aTemplate,aJson,result)
}return result
};
Jsoner.prototype.jsonToMap=function(anArray,aPathToKey,aPathToValue){var result={};
if(COMMONS.isArray(anArray)){var key;
for(var i=0;
i<anArray.length;
i++){key=this.getValue(anArray[i],aPathToKey);
if(COMMONS.isDefined(key)){result[key]=this.getValue(anArray[i],aPathToValue)
}}}else{this.fLogger.error("jsonToMap, unsupported data type, array required: "+anArray)
}return result
};
Jsoner.prototype.visit=function(aJson,anAcceptor,aVisitor){this.jsonTreeWalker(aJson,function(aPath,aValue,anAttributes,aType){var result=true;
if(aType===Jsoner.JSON_NODE_START||aType===Jsoner.JSON_NODE_LEAF||aType===Jsoner.JSON_ATTRIBUTE){if(anAcceptor.call(this,aPath,aValue,anAttributes)){result=aVisitor.call(this,aPath,aValue,anAttributes)
}}return result
})
};
Jsoner.prototype.defaultAcceptor=function(aPath,aJson,aPathPattern,aValuePattern){var result=true;
if(COMMONS.isDefined(aPathPattern)){var path=aPath.join(".");
result=this.isMatch(aPathPattern,path)
}if(result&&COMMONS.isDefined(aValuePattern)){var value;
var pattern;
for(var name in aValuePattern){value=this.getValue(aJson,name);
pattern=aValuePattern[name];
if(COMMONS.isRegExp(pattern)){result=pattern.test(""+value)
}else{result=(pattern===value)
}if(!result){break
}}}return result
};
Jsoner.prototype.lookupAll=function(aJson,aPathPattern,aValuePattern){var result=[];
this.visit(aJson,function(aPath,aValue,anAttributes){return this.defaultAcceptor.call(this,aPath,aValue,aPathPattern,aValuePattern)
},function(aPath,aValue){result.push(aValue);
return true
});
return result
};
Jsoner.prototype.lookupFirst=function(aJson,aPathPattern,aValuePattern){var result=null;
this.visit(aJson,function(aPath,aValue,anAttributes){return this.defaultAcceptor(aPath,aValue,aPathPattern,aValuePattern)
},function(aPath,aValue){result=aValue;
return false
});
return result
};
Jsoner.prototype.isContains=function(aJson,aPathPattern,aValuePattern){var result=this.lookupFirst(aJson,aPathPattern,aValuePattern);
return(result!==null)
};
Jsoner.prototype.getCount=function(aJson,aPathPattern,aValuePattern){var result=0;
this.visit(aJson,function(aPath,aValue,anAttributes){return this.defaultAcceptor(aPath,aValue,aPathPattern,aValuePattern)
},function(aPath,aValue){result++;
return true
});
return result
};
Jsoner.prototype.getAttributes=function(aJson,aPath){var value=this.getValue(aJson,aPath);
var result=this.collectAttributes(aPath,value,aJson);
return result
};
Jsoner.prototype.getChildren=function(aJson,aPath){var result=[];
var obj=this.getValue(aJson,aPath);
if(COMMONS.isDefined(obj)){result=this.collectChildren(aPath,obj,aJson)
}return result
};
Jsoner.prototype.isLeaf=function(aJson,aPath){var children=this.getChildren(aJson,aPath);
return children.length===0
};
Jsoner.prototype.getFirstChild=function(aJson,aPath){var children=this.getChildren(aJson,aPath);
var result=children.length>0?children[0]:undefined;
return result
};
Jsoner.prototype.getLastChild=function(aJson,aPath){var children=this.getChildren(aJson,aPath);
var result=children.length>0?children[children.length-1]:undefined;
return result
};
Jsoner.prototype.addChild=function(aJson,aPath,aValue,aPosition){function parsePath(aPath){var result=aPath;
if(aPath.charAt(aPath.length-1)==="]"){var index=aPath.lastIndexOf("[");
result={path:aPath.substring(0,index),index:aPath.substring(index+1,aPath.length-1)}
}return result
}var obj=this.getValue(aJson,aPath);
if(COMMONS.isUndefined(aPosition)){if(COMMONS.isUndefined(obj)){this.setValue(aJson,aPath,aValue)
}else{if(!COMMONS.isArray(obj)){obj=[obj];
this.setValue(aJson,aPath,obj)
}obj.push(aValue)
}}else{if(COMMONS.isUndefined(obj)){obj=[];
this.setValue(aJson,aPath,obj)
}else{if(!COMMONS.isArray(obj)){obj=[obj];
this.setValue(aJson,aPath,obj)
}if(aPosition<obj.length){for(var i=obj.length-1;
i>=aPosition;
i--){obj[i+1]=obj[i]
}}obj[aPosition]=aValue
}}return aJson
};
Jsoner.prototype.removeChildren=function(aJson,aPath){var obj=this.getValue(aJson,aPath);
if(!COMMONS.isUndefined(obj)){this.setValue(aJson,aPath,undefined);
delete aJson[aPath]
}return aJson
};
Jsoner.prototype.removeChild=function(aJson,aPath,aValue){var obj=this.getValue(aJson,aPath);
if(!COMMONS.isUndefined(obj)){if(COMMONS.isArray(obj)){var index=-1;
for(var i=0;
i<obj.length;
i++){var value=obj[i];
if(value===aValue){index=i;
break
}}if(index!==-1){for(var i=index;
i<obj.length-1;
i++){obj[i]=obj[i+1]
}obj.length=obj.length-1
}}else{if(this.isEquals(obj,aValue)){this.setValue(aJson,aPath,undefined);
delete aJson[aPath]
}}}return aJson
};
Jsoner.prototype.htmlFormEvaluator=function(aForm,aCallBack){if(COMMONS.isDefined(aForm)){for(var i=0;
i<aForm.elements.length;
i++){var element=aForm.elements[i];
if(element.name){aCallBack.call(this,element.name,element)
}}}};
Jsoner.prototype.setFieldValue=function(aElement,aValue){if(COMMONS.isObject(aElement)){if(typeof(aElement)==="select"){for(var i=0;
i<aElement.options.length;
i++){var option=aElement.options[i];
if(option.value===aValue){aElement.selectedIndex=i;
option.selected=true
}else{option.removeAttribute("selected")
}}}else{if(aElement.type==="checkbox"||aElement.type==="radio"){aElement.checked=(aElement.value===(""+aValue))
}else{aElement.value=COMMONS.isDefined(aValue)?aValue:""
}}}};
Jsoner.prototype.getFieldValue=function(aElement){var result=undefined;
if(COMMONS.isObject(aElement)){if(typeof(aElement)==="select"){result=aElement.options[aElement.selectedIndex].value
}else{if(aElement.type==="checkbox"){result=aElement.checked?aElement.value:false
}else{if(aElement.type==="radio"){if(aElement.checked){result=aElement.value
}}else{result=aElement.value
}}}}return result
};
Jsoner.prototype.populateJsonToForm=function(aJson,aForm,aConvertor){if(COMMONS.isDefined(aForm)&&COMMONS.isDefined(aJson)){var convertor=this.converterFactory(aConvertor);
this.htmlFormEvaluator(aForm,function(aElementName,aElement){var path=convertor.call(this,aElementName,aElement);
if(COMMONS.isString(path)){var value=this.getValue(aJson,path);
if(this.getFieldValue(aElement)!==value){this.setFieldValue(aElement,value?value:"");
if(COMMONS.isFunction(aElement.onchange)){aElement.onchange.call(aElement)
}else{if(COMMONS.isFunction(aElement.onclick)){aElement.onclick.call(aElement)
}}}}})
}};
Jsoner.prototype.defaultHtmlConverter=function(aElementName,aElement){var result=aElementName;
if(COMMONS.toBoolean(aElement.readOnly)||COMMONS.toBoolean(aElement.disabled)){result=null
}return result
};
Jsoner.prototype.populateFormToJson=function(aForm,aJson,aConverter){var result=aJson;
var pathSet=new KeySet();
if(COMMONS.isObject(aForm)){var converter=this.converterFactory(aConverter||this.defaultHtmlConverter);
WGGAbstractDebugInterface.gDebugInterface.warn(">>>>>>>>>>>>>>>>>>>>>>>>>>>>> Jsoner.prototype.populateFormToJson");
WGGAbstractDebugInterface.gDebugInterface.warn(converter);
this.htmlFormEvaluator(aForm,function(aElementName,aElement){var path=converter.call(this,aElementName,aElement);
if(COMMONS.isString(path)){var value=this.getFieldValue(aElement);
if(COMMONS.isDefined(value)){var oldValue=this.getValue(result,path);
if(COMMONS.isNumber(oldValue)){value=COMMONS.toFloat(value)
}else{if(COMMONS.isBoolean(oldValue)){value=COMMONS.toBoolean(value)
}}WGGAbstractDebugInterface.gDebugInterface.warn("before populate");
WGGAbstractDebugInterface.gDebugInterface.warn(result);
WGGAbstractDebugInterface.gDebugInterface.warn(path);
WGGAbstractDebugInterface.gDebugInterface.warn(value);
this.populate(result,path,value,true)
}}})
}return result
};
Jsoner.prototype.PATTERN_CDATA_KEY="CDATA";
Jsoner.prototype.PATTERN_DEFAULT_KEY="default";
Jsoner.prototype.selectPatternResolver=function(aJson,aPath,aValue){var result=this.getValue(aJson,aPath);
if(COMMONS.isUndefined(result)){var index=aPath.lastIndexOf(".");
if(index>0){aPath=aPath.substring(index+1)
}if(this.isText(aPath)||this.isCDATA(aPath)){result=this.getValue(aJson,this.PATTERN_CDATA_KEY)
}if(COMMONS.isUndefined(result)){var type=typeof(aValue);
result=this.getValue(aJson,type);
if(COMMONS.isUndefined(result)){result=this.getValue(aJson,this.PATTERN_DEFAULT_KEY)
}}}return this.clone(result)
};
Jsoner.prototype.cascadePatternResolver=function(aJson,aPath,aValue){var result=this.merge(this.getValue(aJson,this.PATTERN_DEFAULT_KEY),this.getValue(aJson,typeof(aValue)),true);
var index=aPath.lastIndexOf(".");
if(index>0){var name=aPath.substring(index+1);
if(this.isText(name)||this.isCDATA(name)){result=this.merge(result,this.getValue(aJson,this.PATTERN_CDATA_KEY),true)
}}var key=[];
var path=aPath.split(".");
for(var i=0;
i<path.length;
i++){key.push(path[i]);
result=this.merge(result,this.getValue(aJson,key.join(".")),true)
}return result
};
Jsoner.prototype.jsonToHTML=function(aJson,aPattern,aPatternResolver,aParentNodeProvider,aNodeFactory){var patternResolver=aPatternResolver||this.cascadePatternResolver;
var nodeFactory=aNodeFactory||this.jsonToDOM;
var parentNodeProvider=COMMONS.isFunction(aParentNodeProvider)?aParentNodeProvider:function(){return aParentNodeProvider
};
this.jsonPathEvaluator(aJson,function(aName,aValue){var pattern=patternResolver.call(this,aPattern,aName,aValue);
if(COMMONS.isDefined(pattern)){var parent=parentNodeProvider.call(this,aName,aValue);
if(COMMONS.isObject(parent)){var node=nodeFactory.call(this,pattern,parent.ownerDocument||document,aName,aValue);
if(COMMONS.isObject(node)){if(COMMONS.isArray(node)){for(var i=0;
i<node.length;
i++){parent.appendChild(node[i])
}}else{parent.appendChild(node)
}}}}return true
})
};
Jsoner.prototype.jsonToDOM=function(aJson,aDocument,aNodeConverter,anAttributeConverter){var result=null;
var parent=null;
var level=0;
var nodeConverter=this.converterFactory(aNodeConverter);
var attributeConverter=this.converterFactory(anAttributeConverter);
this.jsonTreeWalker(aJson,function(aPath,aValue,anAttributes,aType,aLevel){var element=null;
if(aType===Jsoner.JSON_NODE_START||aType===Jsoner.JSON_NODE_LEAF||aType===Jsoner.JSON_ATTRIBUTE){var nodeName=nodeConverter.call(this,this.getLastProperty(aPath),aValue);
if(COMMONS.isString(nodeName)){element=aDocument.createElement(nodeName);
if(aType===Jsoner.JSON_ATTRIBUTE){element.appendChild(aDocument.createTextNode(aValue))
}if(COMMONS.isArray(anAttributes)){for(var i=0;
i<anAttributes.length;
i++){var attribute=anAttributes[i];
var name=attributeConverter.call(this,attribute.name,attribute.value,aPath);
if(COMMONS.isDefined(name)){var value=attribute.value;
if(this.isText(name)||this.isCDATA(name)){element.appendChild(aDocument.createTextNode(value))
}else{if(name==="class"){element.className=value
}else{if(COMMONS.isIE&&(name.indexOf("on")===0)){element.attachEvent(name,new Function("",value))
}else{if(COMMONS.isIE&&name==="style"){element.style.cssText=value
}else{element.setAttribute(name,value)
}}}}}}}if(aLevel===0){result=result?[result]:element;
if(COMMONS.isArray(result)){result.push(element)
}}else{while(level>=aLevel){parent=parent.parentNode;
level--
}if((aPath==="tr"||aPath==="TR")&&parent.nodeName==="TABLE"){var tbody=aDocument.createElement("tbody");
parent.appendChild(tbody);
parent=tbody
}parent.appendChild(element)
}parent=element;
level=aLevel
}}return true
});
return result
};
var SERIALIZER={version:1.24};
SERIALIZER.RESERVED_WORDS=new KeySet("abstract","as","boolean","break","byte","case","catch","char","class","continue","const","debugger","default","delete","do","double","else","enum","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","is","long","let","namespace","native","new","null","package","private","prototype","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","use","var","void","volatile","while","with");
SERIALIZER.fDefaults=new HashMap();
function Walker(){var self=JSINER.extend(this,Jsoner);
self.isWalkNode=function(aName,aValue){return COMMONS.isObject(aValue)&&isNaN(aValue.nodeType)
};
return self
}Walker.prototype.fLogger=new Logger("Serializer.Walker");
Walker.prototype.getAttrName=function(aName){var result=String(aName);
if(SERIALIZER.RESERVED_WORDS.isContains(result)||result.indexOf(" ")>=0||result.indexOf(".")>=0){result='"'+result+'"'
}return result
};
Walker.prototype.isMute=function(aName,aValue,aParent){var result=aName===Jsoner.MAGIC_HASH_CODE||!aParent.hasOwnProperty(aName)||(COMMONS.isObject(aValue)&&!isNaN(aValue.nodeType));
return result
};
Walker.prototype.getDefaultInstance=function(anObject){var type=JSINER.getType(anObject);
var result=SERIALIZER.fDefaults.get(type);
if(COMMONS.isUndefined(result)){result=anObject;
if(COMMONS.isObject(anObject)){try{var cons=JSINER.getConstructor(anObject);
result=new cons();
SERIALIZER.fDefaults.put(type,result)
}catch(ex){this.fLogger.warning("getDefaultInstance, unable to create new instance:"+type,ex)
}}}return result
};
Walker.prototype.isDefaultProperty=function(aDefault,aName,aValue){var result=false;
if(COMMONS.isDefined(aDefault)){try{var value=this.getValue(aDefault,aName);
result=this.isEquals(aValue,value)
}catch(ex){this.fLogger.warning("isDefaultProperty, unable to get property:"+aName,ex)
}}return result
};
Walker.prototype.array=[];
Walker.prototype.isPureArray=function(anObject){var result=COMMONS.isArray(anObject);
if(result){var value;
for(var name in anObject){if(name!=Jsoner.MAGIC_HASH_CODE){value=anObject[name];
if(isNaN(Number(name))&&!this.isDefaultProperty(this.array,name,value)){result=false;
break
}}}}return result
};
Walker.prototype.collectAttributes=function(aPath,aValue,anObject){var result=[];
var value;
var property;
if(COMMONS.isDefined(aValue)){var def=this.getDefaultInstance(anObject);
var path=aPath.join(".");
for(var name in aValue){try{value=aValue[name];
if(!this.isMute(name,value,aValue)&&this.isAttribute(name,value)){property=path.length>0?path+"."+name:name;
if(!this.isDefaultProperty(def,property,value)){result.push({name:name,value:value})
}}}catch(ex){this.fLogger.error("collectAttributes, unable to collect attribute:"+name,ex)
}}}return result
};
Walker.prototype.collectChildren=function(aPath,aValue,anObject){var value;
var property;
var result=[];
if(!this.isPureArray(aValue)){var def=this.getDefaultInstance(anObject);
var path=aPath.join(".");
for(var name in aValue){try{value=aValue[name];
if(!this.isMute(name,value,aValue)&&!this.isAttribute(name,value)){property=path.length>0?path+"."+name:name;
if(!this.isDefaultProperty(def,property,value)){result.push({name:name,value:value})
}}}catch(ex){this.fLogger.warning("collectChildren, unable to collect child:"+name,ex)
}}}return result
};
function Serializer(aPettyPrint){function ValueWalker(){return JSINER.extend(this,Walker)
}ValueWalker.prototype.getDefaultInstance=function(anObject){var def=ValueWalker.superClass.getDefaultInstance.call(this,anObject.value);
return{value:def}
};
this.fSerializers=new HashMap();
this.fDeserializers=new HashMap();
this.fPettyPrint=aPettyPrint;
this.fWalker=new ValueWalker();
this.fWalker.isWalkArray=function(aName,aValue){return false
};
this.fCrossLinker=new ValueWalker();
this.initProcessors()
}Serializer.FIELD_TYPE="jsonSpecificType";
Serializer.FIELD_STREAM="data";
Serializer.DECODE_TABLE={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};
Serializer.REGEXP_TEST=/["\\\x00-\x1f]/;
Serializer.REGEXP_REPLACE=/([\x00-\x1f\\"])/g;
Serializer.SERIALIZE_METHOD="toJSONString";
Serializer.DESERIALIZE_METHOD="stringToJSON";
Serializer.prototype.fLogger=new Logger("Serializer");
Serializer.prototype.registerSerializer=function(aType,aSerializer){if(COMMONS.isFunction(aSerializer)){this.fSerializers.put(aType,aSerializer)
}else{this.fLogger.warning("registerSerializer, illegal argument type:"+aSerializer)
}};
Serializer.prototype.registerDeserializer=function(aType,aDeserializer){if(COMMONS.isFunction(aDeserializer)){this.fDeserializers.put(aType,aDeserializer)
}else{this.fLogger.warning("registerSerializer, illegal argument type:"+aDeserializer)
}};
Serializer.prototype.initProcessors=function(){this.registerSerializer("object",this.serializeObject);
this.registerDeserializer("object",this.deserializeObject);
this.registerSerializer("string",this.serializeString);
this.registerSerializer("function",this.serializeFunction);
this.registerSerializer("Date",this.serializeDate);
this.registerDeserializer("Date",this.deserializeDate);
this.registerSerializer("RegExp",this.serializeRegexp)
};
Serializer.prototype.getSerializer=function(anObject){function defaultSerializer(anObject){return String(anObject)
}var result=null;
if(COMMONS.isDefined(anObject)){result=anObject[Serializer.SERIALIZE_METHOD];
if(!COMMONS.isFunction(result)){result=this.fSerializers.get(JSINER.getType(anObject));
if(!COMMONS.isFunction(result)){result=this.fSerializers.get(typeof(anObject))
}}}if(!COMMONS.isFunction(result)){result=defaultSerializer
}return result
};
Serializer.prototype.getDeserializer=function(anObject){var result=COMMONS.isDefined(anObject)?anObject[Serializer.DESERIALIZE_METHOD]:null;
if(!COMMONS.isFunction(result)&&COMMONS.isDefined(anObject)){var type=anObject[Serializer.FIELD_TYPE];
if(COMMONS.isDefined(type)){result=this.fDeserializers.get(type)
}}if(!COMMONS.isFunction(result)){result=this.fDeserializers.get(typeof(anObject));
if(!COMMONS.isFunction(result)){result=COMMONS.proxy
}}return result
};
Serializer.prototype.serializeDate=function(aDate){var time=aDate.getTime();
aDate.time=aDate.getTime();
var result=this.serializeObject(aDate);
aDate.time=undefined;
delete aDate.time;
return result
};
Serializer.prototype.deserializeDate=function(aString){var result=this.deserializeObject(aString);
if(COMMONS.isDefined(result.time)){result.setTime(result.time);
result.time=undefined;
delete result.time
}return result
};
Serializer.prototype.serializeRegexp=function(aRegExp){return aRegExp.toString()
};
Serializer.prototype.serializeFunction=function(aFunc){var result=aFunc.toString();
var ind1=result.indexOf(" ")+1;
var ind2=result.indexOf("(");
if(ind1<ind2){result=result.substring(ind1,ind2)
}else{this.fLogger.warning("serializeFunction, anonymous function: "+result)
}return result
};
Serializer.prototype.serializeString=function(aString){if(Serializer.REGEXP_TEST.test(aString)){aString=aString.replace(Serializer.REGEXP_REPLACE,function(a,b){var c=Serializer.DECODE_TABLE[b];
if(COMMONS.isDefined(c)){return c
}c=b.charCodeAt();
return"\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16)
})
}return'"'+aString+'"'
};
Serializer.prototype.serializeObject=function(anObject){var result="";
var stack=[];
var serializer=this;
var pettyPrint=this.fPettyPrint;
this.fWalker.jsonTreeWalker({value:anObject},function(aPath,aValue,anAttributes,aType){var value;
var func;
var b=false;
if(aType===Jsoner.JSON_NODE_START||aType===Jsoner.JSON_NODE_LEAF){if(aPath.length>1){if(result.charAt(result.length-1)!=="{"){result+=pettyPrint?",\n":","
}var attrName=this.getAttrName(this.getLastProperty(aPath));
if(attrName&&attrName.indexOf('"')==-1){attrName='"'+attrName+'"'
}result+=attrName+":"
}if(this.isPureArray(aValue)){result+="[";
for(var i=0;
i<aValue.length;
i++){func=serializer.getSerializer(aValue[i]);
if(COMMONS.isFunction(func)){if(b){result+=","
}result+=func.call(serializer,aValue[i]);
b=true
}}stack.push("]")
}else{var type=JSINER.getType(aValue);
if(type==="Object"){result+="{";
stack.push("}")
}else{result+='{"'+Serializer.FIELD_TYPE+'":"'+type+'",';
result+='"'+Serializer.FIELD_STREAM+'":'+(pettyPrint?"\n{":" {");
stack.push(pettyPrint?"}\n}":"}}")
}for(var i=0;
i<anAttributes.length;
i++){value=anAttributes[i].value;
func=serializer.getSerializer(value);
if(COMMONS.isFunction(func)){value=func.call(serializer,value);
if(b){result+=pettyPrint?",\n":","
}var attrName=this.getAttrName(anAttributes[i].name);
if(attrName&&attrName.indexOf('"')==-1){attrName='"'+attrName+'"'
}result+=attrName+":"+value;
b=true
}}}}if(aType===Jsoner.JSON_NODE_END||aType===Jsoner.JSON_NODE_LEAF){result+=stack.pop()
}return true
});
return result
};
Serializer.prototype.deserializeObject=function(anObject){var result=anObject;
var value;
var func;
if(COMMONS.isObject(anObject)){var type=anObject[Serializer.FIELD_TYPE];
if(COMMONS.isString(type)){try{var cons=JSINER.getConstructor(type);
result=new cons();
var data=anObject[Serializer.FIELD_STREAM];
if(COMMONS.isObject(data)){for(var name in data){if(data.hasOwnProperty(name)){value=anObject.data[name];
func=this.getDeserializer(value);
if(COMMONS.isFunction(func)){result[name]=func.call(this,value)
}}}}}catch(ex){this.fLogger.error("deSerialize error "+type,ex)
}}else{for(var name in anObject){if(anObject.hasOwnProperty(name)){value=anObject[name];
func=this.getDeserializer(value);
if(COMMONS.isFunction(func)){result[name]=func.call(this,value)
}}}}}return result
};
Serializer.prototype.serialize=function(anObject){var result="undefined";
var func=this.getSerializer(anObject);
if(COMMONS.isDefined(func)){try{result=func.call(this,anObject);
var pettyPrint=this.fPettyPrint;
this.fCrossLinker.jsonPathEvaluator({value:anObject},function(aPath,aValue,aType){if(aType===Jsoner.JSON_NODE_CROSS_LINKED){result+=pettyPrint?";\n":";";
var value=aValue.substring(6+Jsoner.CROSS_LINK_PREFIX.length);
result+=Jsoner.CROSS_LINK_PREFIX+"."+aPath.substring(6)+"="+(value.length>0?+"result."+value:"result")
}return true
})
}catch(ex){this.fLogger.error("serialize error",ex)
}result+=";"
}else{this.fLogger.error("serialize, corresponding serializer not found:"+anObject)
}return result
};
Serializer.prototype.deserialize=function(aString){var result=undefined;
if(COMMONS.isString(aString)){var object=aString;
var crossLink=null;
var index=aString.indexOf(Jsoner.CROSS_LINK_PREFIX);
if(index>0){object=aString.substring(0,index);
crossLink=aString.substring(index).replace(new RegExp(Jsoner.CROSS_LINK_PREFIX,"g"),"result")
}try{var _2a6=undefined;
eval("_2a6 ="+object);
if(_2a6!==undefined){var func=this.getDeserializer(_2a6);
if(COMMONS.isDefined(func)){result=func.call(this,_2a6)
}}if(crossLink!==null){try{eval(crossLink)
}catch(ex){this.fLogger.error("deSerialize, unable to deserialize cross links:"+crossLink,ex)
}}}catch(ex){this.fLogger.error("deSerialize error",ex)
}}else{this.fLogger.error("deSerialize error, illegal argument type:"+aString)
}return result
};
var UNDO_MANAGER={version:1.24};
function UndoableAction(aDoMethod,aUndoMethod,aDoParams,aUndoParams,aName,aGroup){this.fStatus=undefined;
this.fName=COMMONS.isString(aName)?aName:undefined;
this.fGroup=aGroup;
this.fDoMethod=aDoMethod;
this.fUndoMethod=aUndoMethod||aDoMethod;
this.fDoParams=COMMONS.isUndefined(aDoParams)||COMMONS.isArray(aDoParams)?aDoParams:[aDoParams];
this.fUndoParams=COMMONS.isUndefined(aUndoParams)||COMMONS.isArray(aUndoParams)?aUndoParams:[aUndoParams]
}UndoableAction.prototype.fLogger=new Logger("UndoableAction");
UndoableAction.STATUS_DO_OK=1;
UndoableAction.STATUS_DO_ERROR=1000;
UndoableAction.STATUS_UNDO_OK=2;
UndoableAction.STATUS_UNDO_ERROR=1001;
UndoableAction.prototype.getGroup=function(){return this.fGroup
};
UndoableAction.prototype.getName=function(anUndo){return this.fName
};
UndoableAction.prototype.getStatus=function(){return this.fStatus
};
UndoableAction.prototype.callDo=function(){if(COMMONS.isFunction(this.fDoMethod)){try{if(COMMONS.isArray(this.fDoParams)){this.fDoMethod.apply(this,this.fDoParams)
}else{this.fDoMethod.call(this)
}this.fStatus=UndoableAction.STATUS_DO_OK
}catch(ex){this.fStatus=UndoableAction.STATUS_DO_ERROR;
this.fLogger.error("doAction, error happened",ex,this.fDoMethod)
}}};
UndoableAction.prototype.callUndo=function(){if(COMMONS.isFunction(this.fUndoMethod)){try{if(COMMONS.isArray(this.fUndoParams)){this.fUndoMethod.apply(this,this.fUndoParams)
}else{this.fUndoMethod.call(this)
}this.fStatus=UndoableAction.STATUS_UNDO_OK
}catch(ex){this.fStatus=UndoableAction.STATUS_UNDO_ERROR;
this.fLogger.error("undoAction, error happened",ex,this.fUndoMethod)
}}};
UndoableAction.prototype.isReversible=function(){var result=this.fDoMethod===this.fUndoMethod&&COMMONS.isEquals(this.fDoParams,this.fUndoParams);
return result
};
UndoableAction.prototype.merge=function(aUndoableAction){var result=false;
if(aUndoableAction instanceof UndoableAction){if(COMMONS.isDefined(this.fGroup)&&this.fGroup===aUndoableAction.getGroup()&&COMMONS.isDefined(this.fDoParams)){if(this.fDoMethod===aUndoableAction.fDoMethod&&this.fUndoMethod===aUndoableAction.fUndoMethod){this.fDoParams=aUndoableAction.fDoParams;
result=true
}}}else{this.fLogger.error("merge, illegal agrument type:"+aUndoableAction)
}return result
};
function UndoManager(aMaxSize){this.fMaxSize=COMMONS.isNumber(aMaxSize)?aMaxSize:32;
this.fUndoData=[];
this.fRedoData=[]
}UndoManager.prototype.fLogger=new Logger("UndoManager");
UndoManager.prototype.getUndoStack=function(){return this.fUndoData
};
UndoManager.prototype.isUndoFound=function(){var stack=this.getUndoStack();
return stack.length>0
};
UndoManager.prototype.getRedoStack=function(){return this.fRedoData
};
UndoManager.prototype.isRedoFound=function(){var stack=this.getRedoStack();
return stack.length>0
};
UndoManager.prototype.callDo=function(anUndoableAction,aID){if(anUndoableAction instanceof UndoableAction){try{anUndoableAction.callDo();
if(anUndoableAction.getStatus()===UndoableAction.STATUS_DO_OK){this.addAction(anUndoableAction,aID)
}else{this.processErrorDo(anUndoableAction)
}}catch(ex){this.processErrorDo(anUndoableAction,ex)
}}else{this.fLogger.info("callDo, illegal argument:"+anUndoableAction)
}};
UndoManager.prototype.addAction=function(anUndoableAction,aID){if(anUndoableAction instanceof UndoableAction){var add=true;
if(this.isUndoFound()){var lastAction=this.fUndoData[this.fUndoData.length-1].action;
add=!lastAction.merge(anUndoableAction);
if(!add&&lastAction.isReversible()){this.fUndoData.length--
}}if(add){if(!COMMONS.isDefined(anUndoableAction.fLogger)){anUndoableAction.fLogger=this.fLogger
}var data={id:aID,action:anUndoableAction};
var stack=this.getUndoStack();
if(stack.length<this.fMaxSize){stack.push(data)
}else{stack.shift(data)
}if(this.isRedoFound()){var lastAction=this.fRedoData[this.fRedoData.length-1].action;
if(!COMMONS.isEquals(anUndoableAction,lastAction)){this.fRedoData.length=0
}}}}else{this.fLogger.info("addAction, illegal argument:"+anUndoableAction)
}};
UndoManager.prototype.callUndo=function(){if(this.isUndoFound()){var data=this.getUndoStack().pop();
if(COMMONS.isObject(data)){var undoableAction=data.action;
try{undoableAction.callUndo();
if(undoableAction.getStatus()===UndoableAction.STATUS_UNDO_OK){var stack=this.getRedoStack();
if(stack.length<this.fMaxSize){stack.push(data)
}else{stack.shift(data)
}}else{this.processErrorUndo(data)
}}catch(ex){this.processErrorUndo(data,ex)
}}}else{this.fLogger.info("callUndo, undo stack is empty")
}};
UndoManager.prototype.callRedo=function(){if(this.isRedoFound()){var data=this.getRedoStack().pop();
if(COMMONS.isObject(data)){var action=data.action;
try{action.callDo();
if(action.getStatus()===UndoableAction.STATUS_DO_OK){var stack=this.getUndoStack();
if(stack.length<this.fMaxSize){stack.push(data)
}else{stack.shift(data)
}}else{this.processErrorDo(action)
}}catch(ex){this.processErrorDo(data,ex)
}}}else{this.fLogger.info("callRedo, redo stack is empty")
}};
UndoManager.prototype.processErrorUndo=function(aUndoableAction,anException){};
UndoManager.prototype.processErrorDo=function(aUndoableAction,anException){};
UndoManager.prototype.clear=function(){this.getUndoStack().length=0;
this.getRedoStack().length=0
};
var UPDATER={version:1.24};
var UpdaterDOMUtils={};
UpdaterDOMUtils.ELEMENT_NODE=1;
UpdaterDOMUtils.TEXT_NODE=3;
UpdaterDOMUtils.DOCUMENT_NODE=9;
UpdaterDOMUtils.getElement=function(anElement){var result=COMMONS.isString(anElement)?document.getElementById(anElement):anElement;
return result
};
UpdaterDOMUtils.getDocument=function(anElement){var result=anElement;
if(anElement.nodeType!==this.DOCUMENT_NODE){result=anElement.ownerDocument
}return result
};
UpdaterDOMUtils.addEventListener=function(anObject,aEventName,aCallback){var element=this.getElement(anObject);
if(element){if(COMMONS.isIE){element.attachEvent("on"+aEventName,aCallback)
}else{element.addEventListener(aEventName,aCallback,true)
}}};
UpdaterDOMUtils.removeEventListener=function(anObject,aEventName,aCallback){var element=this.getElement(anObject);
if(element){if(COMMONS.isIE){element.detachEvent("on"+aEventName,aCallback)
}else{element.removeEventListener(aEventName,aCallback,true)
}}};
UpdaterDOMUtils.getEventTarget=function(anEvent){var result=anEvent.srcElement||anEvent.target;
if(result&&result.nodeType===this.TEXT_NODE){result=result.parentNode
}return result
};
UpdaterDOMUtils.getEventKeyCode=function(anEvent){var result=anEvent.keyCode||anEvent.charCode;
return result
};
function Executor(aProcess,aTimeout,aCounter,aOnStop,aWait){this.fOnStop=aOnStop;
this.fProcess=aProcess;
this.fWait=aWait;
this.fLock=false;
this.fCounter=isNaN(aCounter)?1000000:aCounter;
this.fTimeout=isNaN(aTimeout)?500:aTimeout;
this.fLockCheckerTimeout=Math.round(this.fTimeout()/4);
this.fOwnExecutor=null;
this.fJoinedExecutors=[];
this.fLogger=new Logger("Executor");
this.fTaskID=null;
this.fLockCheckerTaskID=null
}Executor.prototype.isLocked=function(){var result=this.fTaskID&&this.fLock;
if(!result){var executor;
for(var i=0;
i<this.fJoinedExecutors.length;
i++){executor=this.fJoinedExecutors[i];
if(executor.isLocked()){result=true;
break
}}}return result
};
Executor.prototype.isAlive=function(){return this.fCounter>0
};
Executor.prototype.onStopCallBack=function(){if(COMMONS.isFunction(this.fOnStop)){try{this.fOnStop.call(this)
}catch(ex){this.fLogger.error("Executor onStop error caused",ex)
}}};
Executor.prototype.start=function(){this.fLock=false;
this.doStart()
};
Executor.prototype.doStart=function(){var executor=this;
if(this.fLockCheckerTaskID!==null){window.clearTimeout(this.fLockCheckerTaskID);
this.fLockCheckerTaskID=null
}if(this.isLocked()){this.fLockCheckerTaskID=window.setTimeout(function(){executor.doStart()
},this.fLockCheckerTimeout)
}else{if(this.fTaskID!==null){window.clearTimeout(this.fTaskID);
this.fTaskID=null
}if(this.isAlive()){if(COMMONS.isFunction(this.fProcess)){if(this.fWait){this.fLock=true
}try{this.fProcess.call(this)
}catch(ex){this.fLogger.error("Executor process error caused",ex)
}this.fLock=false
}this.fCounter--;
this.fTaskID=window.setTimeout(function(){executor.doStart()
},this.fTimeout)
}else{this.onStopCallBack()
}}};
Executor.prototype.stop=function(){this.fCounter=-1;
var executor;
for(var i=0;
i<this.fJoinedExecutors.length;
i++){executor=this.fJoinedExecutors[i];
if(executor.isAlive()){try{executor.stop()
}catch(ex){this.fLogger.error("Unable to stop an executor because an error occured",ex)
}}}};
Executor.prototype.fireStop=function(){var executor;
for(var i=0;
i<this.fJoinedExecutors.length;
i++){executor=this.fJoinedExecutors[i];
try{executor.fireStop()
}catch(ex){this.fLogger.error("Unable to stop an executor because an error occured",ex)
}}if(this.fLockCheckerTaskID!==null){window.clearTimeout(this.fLockCheckerTaskID);
this.fLockCheckerTaskID=null
}if(this.fTaskID!==null){window.clearTimeout(this.fTaskID);
this.fTaskID=null
}this.onStopCallBack();
this.fCounter=-1
};
Executor.prototype.chain=function(anExecutor){if(anExecutor instanceof Executor){anExecutor.fOwnExecutor=this;
this.fJoinedExecutors.push(anExecutor)
}else{this.fLogger.error("joinProcess, illegal argument type: "+anExecutor)
}};
function Updater(aTimeout,aContainer){this.fActions=[];
this.fUIProcessors=new HashMap();
this.fKeys=new HashMap();
this.fKeyBuffer="";
this.fKeyBufferSize=-1;
this.fLock=false;
this.fCheckWord=false;
this.fCheckKey=false;
this.fProcessID=null;
this.fAutoRepeatTaskID=null;
this.fTimeout=isNaN(aTimeout)?50:aTimeout;
this.fLogger=new Logger("Updater");
this.fContainer=COMMONS.isObject(aContainer)||document;
this.initKeyMaps();
this.initUIProcessors()
}Updater.KB_BSP=8;
Updater.KB_TAB=9;
Updater.KB_CENTER=12;
Updater.KB_ENTER=13;
Updater.KB_CTRL=17;
Updater.KB_CAPS=20;
Updater.KB_ESC=27;
Updater.KB_PAGE_UP=33;
Updater.KB_PAGE_DOWN=34;
Updater.KB_END=35;
Updater.KB_HOME=36;
Updater.KB_LEFT=37;
Updater.KB_UP=38;
Updater.KB_RIGHT=39;
Updater.KB_DOWN=40;
Updater.KB_DEL=46;
Updater.KB_PLUS=107;
Updater.KB_MINUS=109;
Updater.KB_PLUS_KB=61;
Updater.KB_MINUS_KB=189;
Updater.prototype.registerKeyMap=function(aName,aCode){this.fKeys.put(aName,aCode)
};
Updater.prototype.initKeyMaps=function(){this.registerKeyMap("LEFT",Updater.KB_LEFT);
this.registerKeyMap("UP",Updater.KB_UP);
this.registerKeyMap("RIGHT",Updater.KB_RIGHT);
this.registerKeyMap("DOWN",Updater.KB_DOWN);
this.registerKeyMap("PAGE_UP",Updater.KB_PAGE_UP);
this.registerKeyMap("PAGE_DOWN",Updater.KB_PAGE_DOWN);
this.registerKeyMap("PLUS",Updater.KB_PLUS);
this.registerKeyMap("PLUSKB",Updater.KB_PLUS_KB);
this.registerKeyMap("MINUS",Updater.KB_MINUS);
this.registerKeyMap("MINUSKB",Updater.KB_MINUS_KB);
this.registerKeyMap("TAB",Updater.KB_TAB);
this.registerKeyMap("CENTER",Updater.KB_CENTER);
this.registerKeyMap("ENTER",Updater.KB_ENTER);
this.registerKeyMap("ESC",Updater.KB_ESC)
};
Updater.prototype.registerUIProcessor=function(aNodeName,aFunction){this.fUIProcessors.put(aNodeName,aFunction)
};
Updater.prototype.initUIProcessors=function(){this.registerUIProcessor("IMG",this.updateImageUI);
this.registerUIProcessor("BUTTON",this.updateControlUI);
this.registerUIProcessor("INPUT",this.updateControlUI);
this.registerUIProcessor("A",this.updateBlockUI);
this.registerUIProcessor("TD",this.updateBlockUI);
this.registerUIProcessor("DIV",this.updateBlockUI)
};
Updater.prototype.getUIProcessor=function(aNode,aStatus){var result=undefined;
if(COMMONS.isObject(aNode)&&aNode.nodeType===UpdaterDOMUtils.ELEMENT_NODE){result=this.fUIProcessors.get(aNode.nodeName)
}return result
};
Updater.prototype.parseHotKey=function(aHotKey){var result=undefined;
var code;
if(COMMONS.isString(aHotKey)){result=aHotKey.split(" ");
for(var i=0;
i<result.length;
i++){result[i]=result[i].split("-");
code=this.fKeys.get(result[i][result[i].length-1]);
if(code!==undefined){result[i][result[i].length-1]=code
}else{result[i][result[i].length-1]=result[i][result[i].length-1].toUpperCase()
}if(result[i].length>1){var modifier;
for(var j=0;
j<result[i].length-1;
j++){result[i][j]=result[i][j].toUpperCase()
}}}}return result
};
Updater.prototype.isMatchedKey=function(aKeyStroke,aEvent){var keyCode=UpdaterDOMUtils.getEventKeyCode(aEvent);
var result=false;
var keyStroke;
for(var i=0;
i<aKeyStroke.length;
i++){keyStroke=aKeyStroke[i];
if(COMMONS.isNumber(keyStroke[keyStroke.length-1])){result=keyCode===parseInt(keyStroke[keyStroke.length-1])
}else{result=String.fromCharCode(keyCode)===keyStroke[keyStroke.length-1]
}if(result&&keyStroke.length>1){for(var j=0;
j<keyStroke.length-1;
j++){if((keyStroke[j]==="SHIFT"&&!aEvent.shiftKey)||(keyStroke[j]==="CTRL"&&!aEvent.ctrlKey)||(keyStroke[j]==="ALT"&&!aEvent.altKey)){result=false;
break
}}}}return result
};
Updater.prototype.start=function(){this.stop();
var updater=this;
this.fProcessID=window.setInterval(function(){updater.update()
},this.fTimeout);
if(this.keyup===undefined){this.keyup=function(event){if(updater.acceptKeyEvent(event)){updater.keyPressed(event)
}};
UpdaterDOMUtils.addEventListener(this.fContainer,"keyup",this.keyup)
}if(this.mouseup===undefined){this.mouseup=function(event){updater.mouseUp(event)
};
UpdaterDOMUtils.addEventListener(this.fContainer,"mouseup",this.mouseup)
}};
Updater.prototype.stop=function(){if(this.fProcessID!==null){window.clearInterval(this.fProcessID);
this.fProcessID=null
}};
Updater.prototype.destroy=function(){this.stop();
if(this.mouseup!==undefined){UpdaterDOMUtils.removeEventListener(this.fContainer,"mouseup",this.mouseup);
this.mouseup=undefined
}if(this.keyup!==undefined){UpdaterDOMUtils.removeEventListener(this.fContainer,"mouseover",this.keyup);
this.keyup=undefined
}this.fActions=[]
};
Updater.prototype.createAction=function(aID,anAction,aStatusChecker,anElementsID,aHotKey,aAutoTimeout,aMagicWord){var result={id:aID,on:false,status:false,action:COMMONS.isFunction(anAction)?anAction:undefined,checker:COMMONS.isFunction(aStatusChecker)?aStatusChecker:undefined,elements:COMMONS.isArray(anElementsID)?anElementsID:(COMMONS.isString(anElementsID)?[anElementsID]:undefined),autoTimeout:isNaN(aAutoTimeout)?0:aAutoTimeout,key:COMMONS.isString(aHotKey)?this.parseHotKey(aHotKey):undefined,word:COMMONS.isString(aMagicWord)?aMagicWord.toUpperCase():undefined};
return result
};
Updater.prototype.addAction=function(aID,anAction,aStatusChecker,anElementsID,aHotKey,aAutoTimeout,aMagicWord){var action=this.createAction(aID,anAction,aStatusChecker,anElementsID,aHotKey,aMagicWord,aAutoTimeout);
this.fCheckKey=action!==undefined;
if(action.word!==undefined){this.fCheckWord=true;
this.fKeyBufferSize=Math.max(this.fKeyBufferSize,action.word.length)
}var index=this.fActions.length;
for(var i=0;
i<index;
i++){if(this.fActions[i].id===action.id){index=i;
break
}}this.fActions[index]=action
};
Updater.prototype.getAction=function(aID){var result=undefined;
for(var i=0;
i<this.fActions.length;
i++){if(this.fActions[i].id===aID){result=this.fActions[i];
break
}}return result
};
Updater.prototype.acceptKeyEvent=function(aEvent){var result=false;
var element=UpdaterDOMUtils.getEventTarget(aEvent);
if(COMMONS.isObject(element)){result=true;
if(element.nodeName==="TEXTAREA"||element.nodeName==="INPUT"||element.nodeName==="SELECT"||element.nodeName==="BUTTON"){result=COMMONS.toBoolean(element.readOnly)||COMMONS.toBoolean(element.disabled)
}}return result
};
Updater.prototype.switchAction=function(aID,anON){for(var i=0;
i<arguments.length-1;
i++){var action=this.getAction(arguments[i]);
if(COMMONS.isObject(action)){action.on=arguments[arguments.length-1]
}}};
Updater.prototype.acceptAction=function(anAction){var result=COMMONS.isObject(anAction)&&anAction.on&&anAction.status;
return result
};
Updater.prototype.keyPressed=function(event){var result=null;
var action;
if(this.fAutoRepeatTaskID!==null){window.clearTimeout(this.fAutoRepeatTaskID);
this.fAutoRepeatTaskID=null
}if(!this.fLock&&(this.fCheckWord||this.fCheckKey)){var keyCode=UpdaterDOMUtils.getEventKeyCode(event);
if(this.fCheckWord){if(this.fKeyBuffer.length>=this.fKeyBufferSize){this.fKeyBuffer=this.fKeyBuffer.substring(1,this.fKeyBuffer.length)
}this.fKeyBuffer+=String.fromCharCode(keyCode);
for(var i=0;
i<this.fActions.length;
i++){action=this.fActions[i];
if(!action.on&&(this.fKeyBuffer===action.word)){action.on=true
}}}if(this.fCheckKey){for(var i=0;
i<this.fActions.length;
i++){action=this.fActions[i];
if(this.acceptAction(action)&&action.key!==undefined){if(this.isMatchedKey(action.key,event)){this.fLock=true;
try{result=action.action.call(this,event)
}catch(ex){this.fLogger.error("keyPressed, call of the action "+action.id+" an error caused",ex)
}var updater=this;
window.setTimeout(function(){updater.fLock=false
},10);
break
}}}}}return result
};
Updater.prototype.update=function(){var getStatus=function(anAction){var result=true;
if(COMMONS.isFunction(anAction.checker)){result=false;
try{result=anAction.checker.call(this)
}catch(ex){this.fLogger.warning("update, call of action check method an error caused",ex)
}}return result
};
if(!this.fLock){var action;
var element;
var processor;
for(var i=0;
i<this.fActions.length;
i++){action=this.fActions[i];
if(action.on){action.status=getStatus.call(this,action);
if(COMMONS.isArray(action.elements)){for(var j=0;
j<action.elements.length;
j++){element=UpdaterDOMUtils.getElement(action.elements[j]);
processor=this.getUIProcessor(element,action.status);
if(COMMONS.isFunction(processor)){processor.call(this,element,action.status)
}}}}}}};
Updater.prototype.acceptUpdateUI=function(aNode,aStatus){return aNode.status!==aStatus
};
Updater.prototype.updateClassName=function(aNode,aStatus){var result=false;
var className=aNode.className;
if(COMMONS.isString(className)&&/Off\b|On\b/.test(className)){var newValue=(aStatus)?className.replace(/Off\b/,"On"):className.replace(/On\b/,"Off");
if(className!==newValue){aNode.className=newValue;
result=true
}}return result
};
Updater.prototype.updateImageUI=function(anImage,aStatus){if(this.acceptUpdateUI(anImage,aStatus)){if(!this.updateClassName(anImage,aStatus)){var src=anImage.src;
if(COMMONS.isString(src)&&/Off\b|On\b/.test(src)){var newValue=(aStatus)?src.replace(/Off\b/,"On"):src.replace(/On\b/,"Off");
if(src!==newValue){anImage.src=newValue
}}}anImage.status=aStatus
}};
Updater.prototype.updateControlUI=function(aControl,aStatus){if(this.acceptUpdateUI(aControl,aStatus)){if(!this.updateClassName(aControl,aStatus)){if(aStatus){aControl.disabled=undefined;
aControl.removeAttribute("disabled")
}else{aControl.disabled=true
}}aControl.status=aStatus
}};
Updater.prototype.updateBlockUI=function(aBlock,aStatus){if(this.acceptUpdateUI(aBlock,aStatus)){if(!this.updateClassName(aBlock,aStatus)){var clip=aBlock.clip;
if(COMMONS.isDefined(clip)){clip=COMMONS.toInteger(clip)*2;
aBlock.style.backgroundPosition=aStatus?("-"+clip+"px 0"):("0 0")
}}aBlock.status=aStatus;
var processor;
var children=aBlock.childNodes;
for(var i=0;
i<aBlock.childNodes.length;
i++){processor=this.getUIProcessor(children[i],aStatus);
if(COMMONS.isFunction(processor)){processor.call(this,children[i],aStatus)
}}}};
Updater.prototype.mouseUp=function(event){if(this.fAutoRepeatTaskID!==null){window.clearTimeout(this.fAutoRepeatTaskID);
this.fAutoRepeatTaskID=null
}};
Updater.prototype.call=function(aID){var doInvoke=function(anAction){var updater=this;
if(this.fAutoRepeatTaskID!==null){window.clearTimeout(this.fAutoRepeatTaskID);
this.fAutoRepeatTaskID=null
}if(this.fLock){this.fAutoRepeatTaskID=window.setTimeout(function(){doInvoke.call(updater,anAction)
},anAction.autoTimeout)
}else{if(this.acceptAction(anAction)){this.fLock=true;
try{anAction.call(this);
if(this.acceptAction(anAction)){this.fAutoRepeatTaskID=window.setTimeout(function(){doInvoke.call(updater,anAction)
},anAction.autoTimeout)
}}catch(ex){this.fLogger.error("doInvoke, action "+this.fAction.id+" invocation error caused",ex)
}this.fLock=false
}}};
if(this.fAutoRepeatTaskID!==null){window.clearTimeout(this.fAutoRepeatTaskID);
this.fAutoRepeatTaskID=null
}if(!this.fLock){var action=this.getAction(aID);
if(this.acceptAction(action)){this.fLock=true;
var updater=this;
try{action.action.call(this);
if(action.autoTimeout>1&&this.acceptAction(action)){this.fAutoRepeatTaskID=window.setTimeout(function(){doInvoke.call(updater,action)
},action.autoTimeout)
}}catch(ex){this.fLogger.error("invoke, action "+action.id+"invocation error caused",ex)
}this.fLock=false
}}};
if(!this.sh_languages){this.sh_languages={}
}sh_languages.javascript=[[[/\/\/\//g,"sh_comment",1],[/\/\//g,"sh_comment",7],[/\/\*\*/g,"sh_comment",8],[/\/\*/g,"sh_comment",9],[/\b(?:abstract|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|final|finally|for|function|goto|if|implements|in|instanceof|interface|native|new|null|private|protected|prototype|public|return|static|super|switch|synchronized|throw|throws|this|transient|true|try|typeof|var|volatile|while|with)\b/g,"sh_keyword",-1],[/(\+\+|--|\)|\])(\s*)(\/=?(?![*\/]))/g,["sh_symbol","sh_normal","sh_symbol"],-1],[/(0x[A-Fa-f0-9]+|(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?)(\s*)(\/(?![*\/]))/g,["sh_number","sh_normal","sh_symbol"],-1],[/([A-Za-z$_][A-Za-z0-9$_]*\s*)(\/=?(?![*\/]))/g,["sh_normal","sh_symbol"],-1],[/\/(?:\\.|[^*\\\/])(?:\\.|[^\\\/])*\/[gim]*/g,"sh_regexp",-1],[/\b[+-]?(?:(?:0x[A-Fa-f0-9]+)|(?:(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?))u?(?:(?:int(?:8|16|32|64))|L)?\b/g,"sh_number",-1],[/"/g,"sh_string",10],[/'/g,"sh_string",11],[/~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,"sh_symbol",-1],[/\{|\}/g,"sh_cbracket",-1],[/\b(?:Math|Infinity|NaN|undefined|arguments)\b/g,"sh_predef_var",-1],[/\b(?:Array|Boolean|Date|Error|EvalError|Function|Number|Object|RangeError|ReferenceError|RegExp|String|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt)\b/g,"sh_predef_func",-1],[/(?:[A-Za-z]|_)[A-Za-z0-9_]*(?=[ \t]*\()/g,"sh_function",-1]],[[/$/g,null,-2],[/(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,"sh_url",-1],[/<\?xml/g,"sh_preproc",2,1],[/<!DOCTYPE/g,"sh_preproc",4,1],[/<!--/g,"sh_comment",5],[/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,"sh_keyword",-1],[/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,"sh_keyword",6,1],[/&(?:[A-Za-z0-9]+);/g,"sh_preproc",-1],[/<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,"sh_keyword",-1],[/<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,"sh_keyword",6,1],[/@[A-Za-z]+/g,"sh_type",-1],[/(?:TODO|FIXME|BUG)(?:[:]?)/g,"sh_todo",-1]],[[/\?>/g,"sh_preproc",-2],[/([^=" \t>]+)([ \t]*)(=?)/g,["sh_type","sh_normal","sh_symbol"],-1],[/"/g,"sh_string",3]],[[/\\(?:\\|")/g,null,-1],[/"/g,"sh_string",-2]],[[/>/g,"sh_preproc",-2],[/([^=" \t>]+)([ \t]*)(=?)/g,["sh_type","sh_normal","sh_symbol"],-1],[/"/g,"sh_string",3]],[[/-->/g,"sh_comment",-2],[/<!--/g,"sh_comment",5]],[[/(?:\/)?>/g,"sh_keyword",-2],[/([^=" \t>]+)([ \t]*)(=?)/g,["sh_type","sh_normal","sh_symbol"],-1],[/"/g,"sh_string",3]],[[/$/g,null,-2]],[[/\*\//g,"sh_comment",-2],[/(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,"sh_url",-1],[/<\?xml/g,"sh_preproc",2,1],[/<!DOCTYPE/g,"sh_preproc",4,1],[/<!--/g,"sh_comment",5],[/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,"sh_keyword",-1],[/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,"sh_keyword",6,1],[/&(?:[A-Za-z0-9]+);/g,"sh_preproc",-1],[/<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,"sh_keyword",-1],[/<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,"sh_keyword",6,1],[/@[A-Za-z]+/g,"sh_type",-1],[/(?:TODO|FIXME|BUG)(?:[:]?)/g,"sh_todo",-1]],[[/\*\//g,"sh_comment",-2],[/(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,"sh_url",-1],[/(?:TODO|FIXME|BUG)(?:[:]?)/g,"sh_todo",-1]],[[/"/g,"sh_string",-2],[/\\./g,"sh_specialchar",-1]],[[/'/g,"sh_string",-2],[/\\./g,"sh_specialchar",-1]]];
if(!this.sh_languages){this.sh_languages={}
}var sh_requests={};
function sh_isEmailAddress(a){if(/^mailto:/.test(a)){return false
}return a.indexOf("@")!==-1
}function sh_setHref(b,c,d){var a=d.substring(b[c-2].pos,b[c-1].pos);
if(a.length>=2&&a.charAt(0)==="<"&&a.charAt(a.length-1)===">"){a=a.substr(1,a.length-2)
}if(sh_isEmailAddress(a)){a="mailto:"+a
}b[c-2].node.href=a
}function sh_konquerorExec(b){var a=[""];
a.index=b.length;
a.input=b;
return a
}function sh_highlightString(B,o){if(/Konqueror/.test(navigator.userAgent)){if(!o.konquered){for(var F=0;
F<o.length;
F++){for(var H=0;
H<o[F].length;
H++){var G=o[F][H][0];
if(G.source==="$"){G.exec=sh_konquerorExec
}}}o.konquered=true
}}var N=document.createElement("a");
var q=document.createElement("span");
var A=[];
var j=0;
var n=[];
var C=0;
var k=null;
var x=function(i,a){var p=i.length;
if(p===0){return
}if(!a){var Q=n.length;
if(Q!==0){var r=n[Q-1];
if(!r[3]){a=r[1]
}}}if(k!==a){if(k){A[j++]={pos:C};
if(k==="sh_url"){sh_setHref(A,j,B)
}}if(a){var P;
if(a==="sh_url"){P=N.cloneNode(false)
}else{P=q.cloneNode(false)
}P.className=a;
A[j++]={node:P,pos:C}
}}C+=p;
k=a
};
var t=/\r\n|\r|\n/g;
t.lastIndex=0;
var d=B.length;
while(C<d){var v=C;
var l;
var w;
var h=t.exec(B);
if(h===null){l=d;
w=d
}else{l=h.index;
w=t.lastIndex
}var g=B.substring(v,l);
var M=[];
for(;
;
){var I=C-v;
var D;
var y=n.length;
if(y===0){D=0
}else{D=n[y-1][2]
}var O=o[D];
var z=O.length;
var m=M[D];
if(!m){m=M[D]=[]
}var E=null;
var u=-1;
for(var K=0;
K<z;
K++){var f;
if(K<m.length&&(m[K]===null||I<=m[K].index)){f=m[K]
}else{var c=O[K][0];
c.lastIndex=I;
f=c.exec(g);
m[K]=f
}if(f!==null&&(E===null||f.index<E.index)){E=f;
u=K;
if(f.index===I){break
}}}if(E===null){x(g.substring(I),null);
break
}else{if(E.index>I){x(g.substring(I,E.index),null)
}var e=O[u];
var J=e[1];
var b;
if(J instanceof Array){for(var L=0;
L<J.length;
L++){b=E[L+1];
x(b,J[L])
}}else{b=E[0];
x(b,J)
}switch(e[2]){case -1:break;
case -2:n.pop();
break;
case -3:n.length=0;
break;
default:n.push(e);
break
}}}if(k){A[j++]={pos:C};
if(k==="sh_url"){sh_setHref(A,j,B)
}k=null
}C=w
}return A
}function sh_getClasses(d){var a=[];
var b=d.className;
if(b&&b.length>0){var e=b.split(" ");
for(var c=0;
c<e.length;
c++){if(e[c].length>0){a.push(e[c])
}}}return a
}function sh_addClass(c,a){var d=sh_getClasses(c);
for(var b=0;
b<d.length;
b++){if(a.toLowerCase()===d[b].toLowerCase()){return
}}d.push(a);
c.className=d.join(" ")
}function sh_extractTagsFromNodeList(c,a){var f=c.length;
for(var d=0;
d<f;
d++){var e=c.item(d);
switch(e.nodeType){case 1:if(e.nodeName.toLowerCase()==="br"){var b;
if(/MSIE/.test(navigator.userAgent)){b="\r"
}else{b="\n"
}a.text.push(b);
a.pos++
}else{a.tags.push({node:e.cloneNode(false),pos:a.pos});
sh_extractTagsFromNodeList(e.childNodes,a);
a.tags.push({pos:a.pos})
}break;
case 3:case 4:a.text.push(e.data);
a.pos+=e.length;
break
}}}function sh_extractTags(c,b){var a={};
a.text=[];
a.tags=b;
a.pos=0;
sh_extractTagsFromNodeList(c.childNodes,a);
return a.text.join("")
}function sh_mergeTags(d,f){var a=d.length;
if(a===0){return f
}var c=f.length;
if(c===0){return d
}var i=[];
var e=0;
var b=0;
while(e<a&&b<c){var h=d[e];
var g=f[b];
if(h.pos<=g.pos){i.push(h);
e++
}else{i.push(g);
if(f[b+1].pos<=h.pos){b++;
i.push(f[b]);
b++
}else{i.push({pos:h.pos});
f[b]={node:g.node.cloneNode(false),pos:h.pos}
}}}while(e<a){i.push(d[e]);
e++
}while(b<c){i.push(f[b]);
b++
}return i
}function sh_insertTags(k,h){var g=document;
var l=document.createDocumentFragment();
var e=0;
var d=k.length;
var b=0;
var j=h.length;
var c=l;
while(b<j||e<d){var i;
var a;
if(e<d){i=k[e];
a=i.pos
}else{a=j
}if(a<=b){if(i.node){var f=i.node;
c.appendChild(f);
c=f
}else{c=c.parentNode
}e++
}else{c.appendChild(g.createTextNode(h.substring(b,a)));
b=a
}}return l
}function sh_highlightElement(d,g){sh_addClass(d,"sh_sourceCode");
var c=[];
var e=sh_extractTags(d,c);
var f=sh_highlightString(e,g);
var b=sh_mergeTags(c,f);
var a=sh_insertTags(b,e);
while(d.hasChildNodes()){d.removeChild(d.firstChild)
}d.appendChild(a)
}function sh_getXMLHttpRequest(){if(window.ActiveXObject){return new ActiveXObject("Msxml2.XMLHTTP")
}else{if(window.XMLHttpRequest){return new XMLHttpRequest()
}}throw"No XMLHttpRequest implementation available"
}function sh_load(language,element,prefix,suffix){if(language in sh_requests){sh_requests[language].push(element);
return
}sh_requests[language]=[element];
var request=sh_getXMLHttpRequest();
var url=prefix+"sh_"+language+suffix;
request.open("GET",url,true);
request.onreadystatechange=function(){if(request.readyState===4){try{if(!request.status||request.status===200){eval(request.responseText);
var elements=sh_requests[language];
for(var i=0;
i<elements.length;
i++){sh_highlightElement(elements[i],sh_languages[language])
}}else{throw"HTTP error: status "+request.status
}}finally{request=null
}}};
request.send(null)
}function sh_highlightDocument(g,k){var b=document.getElementsByTagName("pre");
for(var e=0;
e<b.length;
e++){var f=b.item(e);
var a=sh_getClasses(f);
for(var c=0;
c<a.length;
c++){var h=a[c].toLowerCase();
if(h==="sh_sourcecode"){continue
}if(h.substr(0,3)==="sh_"){var d=h.substring(3);
if(d in sh_languages){sh_highlightElement(f,sh_languages[d])
}else{if(typeof(g)==="string"&&typeof(k)==="string"){sh_load(d,f,g,k)
}else{throw'Found <pre> element with class="'+h+'", but no such language exists'
}}break
}}}};
if(!this.sh_languages){this.sh_languages={}
}sh_languages.xml=[[[/<\?xml/g,"sh_preproc",1,1],[/<!DOCTYPE/g,"sh_preproc",3,1],[/<!--/g,"sh_comment",4],[/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,"sh_keyword",-1],[/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,"sh_keyword",5,1],[/&(?:[A-Za-z0-9]+);/g,"sh_preproc",-1]],[[/\?>/g,"sh_preproc",-2],[/([^=" \t>]+)([ \t]*)(=?)/g,["sh_type","sh_normal","sh_symbol"],-1],[/"/g,"sh_string",2]],[[/\\(?:\\|")/g,null,-1],[/"/g,"sh_string",-2]],[[/>/g,"sh_preproc",-2],[/([^=" \t>]+)([ \t]*)(=?)/g,["sh_type","sh_normal","sh_symbol"],-1],[/"/g,"sh_string",2]],[[/-->/g,"sh_comment",-2],[/<!--/g,"sh_comment",4]],[[/(?:\/)?>/g,"sh_keyword",-2],[/([^=" \t>]+)([ \t]*)(=?)/g,["sh_type","sh_normal","sh_symbol"],-1],[/"/g,"sh_string",2]]];
shortcut={all_shortcuts:{},add:function(shortcut_combination,callback,opt){var default_options={type:"keydown",propagate:false,disable_in_input:false,target:document,keycode:false};
if(!opt){opt=default_options
}else{for(var dfo in default_options){if(typeof opt[dfo]=="undefined"){opt[dfo]=default_options[dfo]
}}}var ele=opt.target;
if(typeof opt.target=="string"){ele=document.getElementById(opt.target)
}var ths=this;
shortcut_combination=shortcut_combination.toLowerCase();
var func=function(e){e=e||window.event;
if(opt.disable_in_input){var element;
if(e.target){element=e.target
}else{if(e.srcElement){element=e.srcElement
}}if(element.nodeType==3){element=element.parentNode
}if(element.tagName=="INPUT"||element.tagName=="TEXTAREA"){return
}}if(e.keyCode){code=e.keyCode
}else{if(e.which){code=e.which
}}var character=String.fromCharCode(code).toLowerCase();
if(code==188){character=","
}if(code==190){character="."
}var keys=shortcut_combination.split("+");
var kp=0;
var shift_nums={"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":":","'":'"',",":"<",".":">","/":"?","\\":"|"};
var special_keys={esc:27,escape:27,tab:9,space:32,"return":13,enter:13,backspace:8,scrolllock:145,scroll_lock:145,scroll:145,capslock:20,caps_lock:20,caps:20,numlock:144,num_lock:144,num:144,pause:19,"break":19,insert:45,home:36,"delete":46,end:35,pageup:33,page_up:33,pu:33,pagedown:34,page_down:34,pd:34,left:37,up:38,right:39,down:40,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123};
var modifiers={shift:{wanted:false,pressed:false},ctrl:{wanted:false,pressed:false},alt:{wanted:false,pressed:false},meta:{wanted:false,pressed:false}};
if(e.ctrlKey){modifiers.ctrl.pressed=true
}if(e.shiftKey){modifiers.shift.pressed=true
}if(e.altKey){modifiers.alt.pressed=true
}if(e.metaKey){modifiers.meta.pressed=true
}for(var i=0;
k=keys[i],i<keys.length;
i++){if(k=="ctrl"||k=="control"){kp++;
modifiers.ctrl.wanted=true
}else{if(k=="shift"){kp++;
modifiers.shift.wanted=true
}else{if(k=="alt"){kp++;
modifiers.alt.wanted=true
}else{if(k=="meta"){kp++;
modifiers.meta.wanted=true
}else{if(k.length>1){if(special_keys[k]==code){kp++
}}else{if(opt.keycode){if(opt.keycode==code){kp++
}}else{if(character==k){kp++
}else{if(shift_nums[character]&&e.shiftKey){character=shift_nums[character];
if(character==k){kp++
}}}}}}}}}}if(kp==keys.length&&modifiers.ctrl.pressed==modifiers.ctrl.wanted&&modifiers.shift.pressed==modifiers.shift.wanted&&modifiers.alt.pressed==modifiers.alt.wanted&&modifiers.meta.pressed==modifiers.meta.wanted){callback(e);
if(!opt.propagate){e.cancelBubble=true;
e.returnValue=false;
if(e.stopPropagation){e.stopPropagation();
e.preventDefault()
}return false
}}};
this.all_shortcuts[shortcut_combination]={callback:func,target:ele,event:opt.type};
if(ele.addEventListener){ele.addEventListener(opt.type,func,false)
}else{if(ele.attachEvent){ele.attachEvent("on"+opt.type,func)
}else{ele["on"+opt.type]=func
}}},remove:function(shortcut_combination){shortcut_combination=shortcut_combination.toLowerCase();
var binding=this.all_shortcuts[shortcut_combination];
delete (this.all_shortcuts[shortcut_combination]);
if(!binding){return
}var type=binding.event;
var ele=binding.target;
var callback=binding.callback;
if(ele.detachEvent){ele.detachEvent("on"+type,callback)
}else{if(ele.removeEventListener){ele.removeEventListener(type,callback,false)
}else{ele["on"+type]=false
}}}};
var thisDoc=document;
function inherits(base,extension){for(var property in base){try{extension[property]=base[property]
}catch(e){}}}function getMouseKey(e){if(!e&&isIE){e=window.event
}var mouseKey=(e.button)?e.button:e.which;
return mouseKey
}function getKeyboardKey(e){if(!e&&isIE){e=window.event
}var asciiValue=e.which;
if(!asciiValue){asciiValue=e.keyCode
}return asciiValue
}function getPosition(obj){if(obj==null){return null
}var pos={left:0,top:0,width:0,height:0};
pos.toString=function(){return this.left+","+this.top+","+this.width+","+this.height
};
pos.width=obj.offsetWidth;
pos.height=obj.offsetHeight;
if(typeof obj.offsetLeft!="undefined"){while(obj){pos.left+=obj.offsetLeft;
pos.top+=obj.offsetTop;
obj=obj.offsetParent
}}else{pos.left=obj.left;
pos.top=obj.top
}return pos
};
/********** __wggJsCoreInitialized signal **********/
/**
 * Autor: KG
 * werden die WIGeoGIS-JSCore*-Repositories eingesetzt, verfuegt jedes Repository ueber ein WGGScriptLoader, um
 * die enthaltenen Klassen zu laden. Diese ist zu Entwicklungszwecken erforderlich: man haelt die einzelnen Klassen
 * in getrennten Files und benoetigt bei der Verwendung immer nur einen script-Include.
 * Damit der "inkludiertende" Client weiss, dass JSCore komplett geladen wurde, gibt JSCore sog. Signal an den Client, indem
 * er die globale Funktion __wggJsCoreInitialized aufruft. Diese kann es geben, muss es aber nicht. Es ist bloss als Moeglichkeit
 * fuer den Client gedacht, damit er bei Bedarf erkennt, dass JSCore vollstaendig geladen wurde. Desweiteren wird das Debugging
 * aktiviert.
 */
//-- set the bDebug flag
try {
	if( ! __DEBUG__ ) throw "__DEBUG__ global variable not defined by the client";
	var __DEBUG__ = new Boolean(__DEBUG__);
} catch(e) {
	var __DEBUG__ = false;
}
try {
	if( WGGDebugWindow ) {
		if( __DEBUG__ == true ) {
			//WGGAbstractDebugInterface.gDebugInterface = new WGGTextDebugInterface(true);
			WGGAbstractDebugInterface.gDebugInterface = new WGGObjectDebugInterface(true);
			var debugWindow = new WGGDebugWindow("debugWindow_jscore", "menubar=yes,resizable=yes,scrollbars=yes,width=500,height=700");
			WGGAbstractDebugInterface.gDebugInterface.addChangeListener( debugWindow );
		} else {
			WGGAbstractDebugInterface.gDebugInterface = new WGGNullDebugInterface(false);
		}
	} else {
		throw "Class WGGDebugWindow has not been loaded";
	}
} catch( e ) {
	ex = "Critical error while loading jscore framework: ";
	if( typeof e != "string" ) ex += e.message;
	alert( ex );
}

//-- b) print debug info about the initialization of the framework
if( __DEBUG__ ) {
	WGGAbstractDebugInterface.gDebugInterface.info( "all script of the framework 'jscore' loaded" );
}

//-- c) call the client global function __wggJsCoreInitialized
//--    (client can react to the initialization of the framework)
try {
	if( WGGDataTypeUtils.isFunction( __wggJsCoreInitialized ) )
		__wggJsCoreInitialized();
} catch( e ) {
}

