function keepAlive(){var http=new HTTPRequest("/keep-alive.php");http.send();setupKeepAlive()}
function setupKeepAlive(){setTimeout(keepAlive,60000)}
function onLoad(){HTMLUtils.triggerOnLoad();setupKeepAlive();var http=new HTTPRequest("/update-session.php");http.send()}
window.onload=onLoad;function Class(){}
Class.defineStatic=function(theClass,staticDef){for(var m in staticDef)
theClass[m]=staticDef[m]}
Class.definePrototype=function(theClass,protoDef){var proto={};for(var m in protoDef)
proto[m]=protoDef[m];theClass.prototype=proto}
Class.inherits=function(theClass,parentClass,theClassDef){theClass.baseClass=parentClass;var className=parentClass.toString();var ctorMatch=className.match(/\s*function\s*(.*)\(/);if(ctorMatch)
theClass.baseConstructor=parentClass;else
theClass.baseConstructor=function(){};var proto={};for(var m in parentClass.prototype)
proto[m]=parentClass.prototype[m];for(var m in theClassDef)
proto[m]=theClassDef[m];theClass.prototype=proto;return proto}
Class.define=function(classDef){var ctor=null;if(classDef["ctor"])
ctor=classDef["ctor"];else
ctor=function(){};var newClass=ctor;var proto=new Object();proto.constructor=ctor;if(classDef["inherits"]){var parentClass=classDef["inherits"];newClass.baseClass=parentClass;var className=parentClass.toString();var ctorMatch=className.match(/\s*function\s*(.*)\(/);if(ctorMatch)
newClass.baseConstructor=parentClass;else
newClass.baseConstructor=function(){};var parentProto=parentClass.prototype;for(var m in parentProto)
proto[m]=parentProto[m];newClass.basePrototype=parentProto}else
{newClass.baseClass=null;newClass.basePrototype=null;newClass.baseConstructor=null}
if(classDef["static"]){var staticDef=classDef["static"];for(var m in staticDef)
newClass[m]=staticDef[m]}
if(classDef["prototype"]){var protoDef=classDef["prototype"];for(var m in protoDef)
proto[m]=protoDef[m]}
newClass.prototype=proto;if(classDef["prototype"]&&classDef["prototype"]["toString"])
newClass.prototype.toString=classDef["prototype"]["toString"];return newClass}
ArrayList=Class.define
({ctor:function(){this.m_isArrayList=true;this.m_items=new Array()},static:{sortCompareFunction:function(a,b){if(JSUtils.isObject(a)&&JSUtils.isObject(b)&&a.compareTo&&b.compareTo)
return a.compareTo(b);else
return a-b},reverseSortCompareFunction:function(a,b){if(JSUtils.isObject(a)&&JSUtils.isObject(b)&&a.compareTo&&b.compareTo)
return b.compareTo(a);else
return b-a},fromArrayJS:function(array){var arraylist=new ArrayList();for(i=0,n=array.length;i<n;i++)
arraylist.add(array[i]);var clone=arraylist.clone(true);return clone}},prototype:{getCount:function(){return this.m_items.length},isEmpty:function(){return this.getCount()==0},getFirst:function(){return this.isEmpty()?window.undefined:this.m_items[0]},getLast:function(){return this.isEmpty()?window.undefined:this.m_items[this.m_items.length-1]},getAt:function(index){return this.m_items[index]},setAt:function(index,value){this.m_items[index]=value},toArrayJS:function(){var array=new Array();var clone=this.clone(false);for(i=0,n=this.m_items.length;i<n;i++)
array[i]=clone.getAt(i);return array},sort:function(reverse){if(reverse)
this.m_items.sort(ArrayList.reverseSortCompareFunction);else
this.m_items.sort(ArrayList.sortCompareFunction)},clone:function(deep){var res=new ArrayList();for(var i=0,n=this.m_items.length;i<n;++i){if(!deep)
res.m_items[i]=this.m_items[i];else
res.m_items[i]=this.m_items[i].clone()}
return res},add:function(elt){if(elt&&elt.m_isArrayList){for(var i=this.m_items.length,n=0;n<elt.m_items.length;++i,++n)
this.m_items[i]=elt.m_items[n]}else
{this.m_items[this.m_items.length]=elt}},insertAt:function(elt,index){if(index>=this.m_items.length){this.add(elt);return}else if(index<0){index=0}
var newItems=new Array();var n=0;for(var i=0;i<this.m_items.length;++i){if(i==index){if(elt!==null&&elt!==window.undefined&&JSUtils.isObject(elt)&&elt.m_isArrayList){for(var j=0;j<elt.m_items.length;++j)
newItems[n++]=elt.m_items[j]}else
{newItems[n++]=elt}}
newItems[n++]=this.m_items[i]}
this.m_items=newItems},find:function(elt){if(typeof(elt)=="function"){for(var i=0;i<this.m_items.length;++i){if(elt(this.m_items[i]))
return i}}else
{for(var i=0;i<this.m_items.length;++i){var item=this.m_items[i];if(JSUtils.isObject(item)&&item.equals){if(this.m_items[i].equals(elt))
return i}else
{if(this.m_items[i]==elt)
return i}}}
return-1},merge:function(arrayList){var error=false;var i=0;var n=arrayList.getCount();while(i<n&&!error){if(typeof(arrayList.getAt(i))=="object")
this.add(arrayList.getAt(i));else
error=true;i++}},order:function(){var back=false;var n=this.getCount()
for(i=0;i<n-1;i++){var mini=i;for(j=i+1;j<n;j++)
if(this.getAt(j).compareTo)
if(this.getAt(j).compareTo(this.getAt(mini))<0)
mini=j;else
return-1;if(mini!=i){var x=this.getAt(i);this.insertAt(this.getAt(mini),i);this.insertAt(this.getAt(x),mini)}}},sort:function(reverse){if(reverse)
this.m_items.sort(ArrayList.reverseSortCompareFunction);else
this.m_items.sort(ArrayList.sortCompareFunction)},removeAll:function(){this.m_items=new Array()},remove:function(elt){if(elt&&elt.m_isArrayList){var newItems=new Array();var n=0;for(var i=0;i<this.m_items.length;++i){var item=this.m_items[i];var found=false;for(var j=0;!found&&(j<elt.m_items.length);++j)
found=(item==elt.m_items[j]);if(!found)
newItems[n++]=item}
this.m_items=newItems}else
{var index=this.find(elt);if(index!=-1)
this.removeAt(index)}},removeIf:function(callback){var newItems=new Array();var n=0;for(var i=0;i<this.m_items.length;++i){var item=this.m_items[i];if(!callback(item))
newItems[n++]=item}
this.m_items=newItems},removeAt:function(index){var newItems=new Array();var n=0;for(var i=0;i<this.m_items.length;++i){if(i!=index)
newItems[n++]=this.m_items[i]}
this.m_items=newItems},slice:function(offset,length){var res=new ArrayList();for(var i=offset,c=0,n=this.m_items.length;i<n&&c<length;++i,++c)
res.add(this.m_items[i]);return res},toString:function(){var res="[ ";for(var i=0;i<this.m_items.length;++i){if(i!=0)
res+=", ";res+=this.m_items[i]}
res+=" ]";return res}}});DateTime=Class.define
({ctor:function(day,month,year){this.m_day=day;this.m_month=month;this.m_year=year},static:{MONDAY:0,TUESDAY:1,WEDNESDAY:2,THURSDAY:3,FRIDAY:4,SATURDAY:5,SUNDAY:6,DAYS_IN_MONTH:[31,28,31,30,31,30,31,31,30,31,30,31],DAYS_IN_MONTH_LEAPYEAR:[31,29,31,30,31,30,31,31,30,31,30,31],MONTH_NAME:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],DOW_NAME:["Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi","Dimanche"],createFromXML:function(node,tagName){node=XMLUtils.getChildByTagName(node,tagName===window.undefined?"date-time":tagName);if(!node)
return null;return new DateTime(parseInt(node.getAttribute("day")),parseInt(node.getAttribute("month")),parseInt(node.getAttribute("year")))},now:function(){var d=new Date();var y=d.getYear();if(y<50)y=2000+y;else if(y<1900)y=1900+y;return new DateTime(d.getDate(),d.getMonth()+1,y)},epoch:function(){return Math.floor(new Date().getTime()/1000.0)},getDaysInMonth:function(month,year){if(month<1||month>12)
return 0;if(DateTime.isLeapYear(year))
return DateTime.DAYS_IN_MONTH_LEAPYEAR[month-1];else
return DateTime.DAYS_IN_MONTH[month-1]},isLeapYear:function(year){return((year%4)==0)&&(!((year%100)==0)||((year%400)==0))},getMonthName:function(month){if(month<1||month>12)
return null;return DateTime.MONTH_NAME[month-1]},getDayOfWeekName:function(dow){if(dow<0||dow>6)
return null;return DateTime.DOW_NAME[dow]},getDayOfWeek:function(day,month,year){var val1=day;var val2=month;var val2x=month;var val3=year;if(val2==1){val2x=13;val3--}
if(val2==2){val2x=14;val3--}
var val4=Math.floor(((val2x+1)*3)/5);var val5=Math.floor(val3/4);var val6=Math.floor(val3/100);var val7=Math.floor(val3/400);var val8=val1+(val2x*2)+val4+val3+val5-val6+val7+2;var val9=Math.floor(val8/7);var val0=val8-(val9*7);return(val0+5)%7}},prototype:{clone:function(){return new DateTime(this.m_day,this.m_month,this.m_year)},getDay:function(){return this.m_day},getMonth:function(){return this.m_month},getYear:function(){return this.m_year},getDayOfWeek:function(){return DateTime.getDayOfWeek(this.m_day,this.m_month,this.m_year)},getDaysInMonth:function(){return DateTime.getDaysInMonth(this.m_month,this.m_year)},setDay:function(day){var date=this.clone();date.m_day=day;return date},setMonth:function(month){var date=this.clone();date.m_month=month;return date},setYear:function(year){var date=this.clone();date.m_year=year;return date},goToNextMonth:function(){var date=this.clone();if(date.m_month==12){date.m_year++;date.m_month=1}else
{date.m_month++}
var days=DateTime.getDaysInMonth(date.m_month,date.m_year);if(date.m_day>days)
date.m_day=days;return date},goToPreviousMonth:function(){var date=this.clone();if(date.m_month==1){date.m_year--;date.m_month=12}else
{date.m_month--}
var days=DateTime.getDaysInMonth(date.m_month,date.m_year);if(date.m_day>days)
date.m_day=days;return date},isValid:function(){if(this.m_month<1||this.m_month>12)
return false;if(this.m_day<1||this.m_day>DateTime.getDaysInMonth(this.m_month,this.m_year))
return false;return true},addDays:function(days){var d=this.m_day;var m=this.m_month;var y=this.m_year;for(;days>0;--days){++d;if(d>DateTime.getDaysInMonth(m,y)){d=1;m++;if(m>12){m=1;y++}}}
return new DateTime(d,m,y)},isGreaterThan:function(other){return this.compare(other)>0},isGreaterThanOrEqual:function(other){return this.compare(other)>=0},isLowerThan:function(other){return this.compare(other)<0},isLowerThanOrEqual:function(other){return this.compare(other)<=0},equals:function(other){return this.compare(other)==0},compare:function(other){return this._makeInt()-other._makeInt()},toInteger:function(){return this._makeInt()},_makeInt:function(){return this.m_year*100*100+this.m_month*100+this.m_day},writeToXML:function(dom,tagName){var node=dom.createElement(tagName===window.undefined?"date-time":tagName);node.setAttribute("day",this.m_day);node.setAttribute("month",this.m_month);node.setAttribute("year",this.m_year);return node}}});URL=Class.define
({ctor:function(path){this.m_path=(path!=window.undefined?path:"/");this.m_params=[];this.m_anchor=null},static:{parse:function(str){str=JSUtils.toString(str);var sh=str.lastIndexOf("#");var anchor=null;if(sh!=-1){anchor=str.substring(sh+1,str.length);str=str.substring(0,sh)}
var qm=str.indexOf("?");if(qm==-1){var url=new URL(str);url=url.setAnchor(anchor);return url}
var path=str.substring(0,qm);var args=StringUtils.explode("&",str.substring(qm+1,str.length));var url=new URL(path);url=url.setAnchor(URL.unescape(anchor));for(var i=0,n=args.length;i<n;++i){var tmp=StringUtils.explode("=",args[i]);url=url.addParam(URL.unescape(tmp[0]),URL.unescape(tmp[1]))}
return url},unescape:function(str){return unescape(str)},escape:function(str){return StringUtils.replaceString(StringUtils.replaceString(escape(str),"+","%2B"),"@","%40")}},prototype:{clone:function(){var res=new URL();res.m_path=""+this.m_path;res.m_anchor=this.m_anchor;res.m_params=[];for(var i=0,n=this.m_params.length;i<n;++i){var prm=this.m_params[i];res.m_params[res.m_params.length]=[prm[0],prm[1]]}
return res},equals:function(other){return this.toString()==other.toString()},toString:function(){var res=this.m_path;for(var i=0,n=this.m_params.length;i<n;++i){var prm=this.m_params[i];res+=(i==0?'?':'&');res+=URL.escape(prm[0])+"="+URL.escape(prm[1])}
if(this.m_anchor)
res+="#"+URL.escape(this.m_anchor);return res},setPath:function(path){var url=this.clone();url.m_path=path;return url},setAnchor:function(anchor){var url=this.clone();url.m_anchor=anchor;return url},getAnchor:function(){return this.m_anchor},hasParam:function(name){for(var i=0,n=this.m_params.length;i<n;++i){if(this.m_params[i][0]==name)
return true}
return false},getParam:function(name){for(var i=0,n=this.m_params.length;i<n;++i){if(this.m_params[i][0]==name)
return this.m_params[i][1]}
return window.undefined},setParam:function(name,value){return this.addParam(name,value)},addParam:function(name,value){var url=this.clone();for(var i=0,n=url.m_params.length;i<n;++i){if(url.m_params[i][0]==name){url.m_params[i][1]=value;return url}}
url.m_params[url.m_params.length]=[name,value];return url}}});Color=Class.define
({ctor:function(r,g,b,a){if(arguments.length>=3){if(r==window.undefined||r==null||isNaN(r))r=0;if(g==window.undefined||g==null||isNaN(g))g=0;if(b==window.undefined||b==null||isNaN(b))b=0;if(a==window.undefined||a==null||isNaN(a))a=255;this.m_red=Math.min(255,Math.max(0,Math.round(r)));this.m_green=Math.min(255,Math.max(0,Math.round(g)));this.m_blue=Math.min(255,Math.max(0,Math.round(b)));this.m_alpha=Math.min(255,Math.max(0,Math.round(a)))}else
{this.m_red=0;this.m_green=0;this.m_blue=0;this.m_alpha=255}},static:{fromHSV:function(h,s,v){var r,g,b;r=g=b=0;s/=100.0;v/=100.0;if(s<0)s=0;if(s>1)s=1;if(v<0)v=0;if(v>1)v=1;h=h%360;if(h<0)h=h+360;h=h/60;var i=Math.floor(h);var f=h-i;var p1=v*(1-s);var p2=v*(1-s*f);var p3=v*(1-s*(1-f));if(i==0){r=v;g=p3;b=p1}else if(i==1){r=p2;g=v;b=p1}else if(i==2){r=p1;g=v;b=p3}else if(i==3){r=p1;g=p2;b=v}else if(i==4){r=p3;g=p1;b=v}else if(i==5){r=v;g=p1;b=p2}
r=Math.min(255,Math.max(0,Math.round(r*255)));g=Math.min(255,Math.max(0,Math.round(g*255)));b=Math.min(255,Math.max(0,Math.round(b*255)));return new Color(r,g,b)},fromHex:function(hex){if(hex==null||hex==window.undefined||hex.length<1)
return new Color(0,0,0);var res=new Color();if(hex.charAt(0)!='#'&&(hex.length==3||hex.length==6||hex.length==4||hex.length==8))
hex="#"+hex;if(hex.charAt(0)=='#'&&(hex.length==4||hex.length==7||hex.length==5||hex.length==9)){if(hex.length==7||hex.length==9){res.setRed(parseInt(hex.substr(1,2),16));res.setGreen(parseInt(hex.substr(3,2),16));res.setBlue(parseInt(hex.substr(5,2),16));res.setAlpha(hex.length>7?parseInt(hex.substr(7,2),16):255)}else
{res.setRed(parseInt(hex.substr(1,1),16)*16);res.setGreen(parseInt(hex.substr(2,1),16)*16);res.setBlue(parseInt(hex.substr(3,1),16)*16);res.setAlpha(hex.length==5?parseInt(hex.substr(4,1),16)*16:255)}}
return res},createRandom:function(){return new Color(Math.round(Math.random()*255),Math.round(Math.random()*255),Math.round(Math.random()*255))},createLightRandom:function(){return new Color(80+Math.round(Math.random()*170),80+Math.round(Math.random()*170),80+Math.round(Math.random()*170))},createShade2:function(from,to,levels){var r1=from.getRed();var g1=from.getGreen();var b1=from.getBlue();var r2=to.getRed();var g2=to.getGreen();var b2=to.getBlue();var sr=(r2-r1)/levels;var sg=(g2-g1)/levels;var sb=(b2-b1)/levels;var res=new Array();for(var i=0;i<levels;++i){res[i]=new Color
(Math.floor(r1+i*sr),Math.floor(g1+i*sg),Math.floor(b1+i*sb))}
return res},createShade4:function(colors,xShades,yShades){var res=new Array(yShades);for(var i=0;i<yShades;++i)
res[i]=new Array(xShades);var c0=colors[0],c1=colors[1],c2=colors[2],c3=colors[3];var r0=c0.getRed(),g0=c0.getGreen(),b0=c0.getBlue();var r1=c1.getRed(),g1=c1.getGreen(),b1=c1.getBlue();var r2=c2.getRed(),g2=c2.getGreen(),b2=c2.getBlue();var r3=c3.getRed(),g3=c3.getGreen(),b3=c3.getBlue();for(var y=0;y<yShades;++y){var cy=y/(yShades-1);var rs=(cy*r3+(1-cy)*r0);var gs=(cy*g3+(1-cy)*g0);var bs=(cy*b3+(1-cy)*b0);var re=(cy*r2+(1-cy)*r1);var ge=(cy*g2+(1-cy)*g1);var be=(cy*b2+(1-cy)*b1);for(var x=0;x<xShades;++x){var cx=x/(xShades-1);var r=Math.round(cx*re+(1-cx)*rs);var g=Math.round(cx*ge+(1-cx)*gs);var b=Math.round(cx*be+(1-cx)*bs);res[y][x]=new Color(r,g,b)}}
return res},createFromXML:function(dom,node){return Color.fromHex(XMLUtils.getElementText(node))},s_cssSimpleColors:{aliceblue:'f0f8ff',antiquewhite:'faebd7',aqua:'00ffff',aquamarine:'7fffd4',azure:'f0ffff',beige:'f5f5dc',bisque:'ffe4c4',black:'000000',blanchedalmond:'ffebcd',blue:'0000ff',blueviolet:'8a2be2',brown:'a52a2a',burlywood:'deb887',cadetblue:'5f9ea0',chartreuse:'7fff00',chocolate:'d2691e',coral:'ff7f50',cornflowerblue:'6495ed',cornsilk:'fff8dc',crimson:'dc143c',cyan:'00ffff',darkblue:'00008b',darkcyan:'008b8b',darkgoldenrod:'b8860b',darkgray:'a9a9a9',darkgreen:'006400',darkkhaki:'bdb76b',darkmagenta:'8b008b',darkolivegreen:'556b2f',darkorange:'ff8c00',darkorchid:'9932cc',darkred:'8b0000',darksalmon:'e9967a',darkseagreen:'8fbc8f',darkslateblue:'483d8b',darkslategray:'2f4f4f',darkturquoise:'00ced1',darkviolet:'9400d3',deeppink:'ff1493',deepskyblue:'00bfff',dimgray:'696969',dodgerblue:'1e90ff',feldspar:'d19275',firebrick:'b22222',floralwhite:'fffaf0',forestgreen:'228b22',fuchsia:'ff00ff',gainsboro:'dcdcdc',ghostwhite:'f8f8ff',gold:'ffd700',goldenrod:'daa520',gray:'808080',green:'008000',greenyellow:'adff2f',honeydew:'f0fff0',hotpink:'ff69b4',indianred:'cd5c5c',indigo:'4b0082',ivory:'fffff0',khaki:'f0e68c',lavender:'e6e6fa',lavenderblush:'fff0f5',lawngreen:'7cfc00',lemonchiffon:'fffacd',lightblue:'add8e6',lightcoral:'f08080',lightcyan:'e0ffff',lightgoldenrodyellow:'fafad2',lightgrey:'d3d3d3',lightgreen:'90ee90',lightpink:'ffb6c1',lightsalmon:'ffa07a',lightseagreen:'20b2aa',lightskyblue:'87cefa',lightslateblue:'8470ff',lightslategray:'778899',lightsteelblue:'b0c4de',lightyellow:'ffffe0',lime:'00ff00',limegreen:'32cd32',linen:'faf0e6',magenta:'ff00ff',maroon:'800000',mediumaquamarine:'66cdaa',mediumblue:'0000cd',mediumorchid:'ba55d3',mediumpurple:'9370d8',mediumseagreen:'3cb371',mediumslateblue:'7b68ee',mediumspringgreen:'00fa9a',mediumturquoise:'48d1cc',mediumvioletred:'c71585',midnightblue:'191970',mintcream:'f5fffa',mistyrose:'ffe4e1',moccasin:'ffe4b5',navajowhite:'ffdead',navy:'000080',oldlace:'fdf5e6',olive:'808000',olivedrab:'6b8e23',orange:'ffa500',orangered:'ff4500',orchid:'da70d6',palegoldenrod:'eee8aa',palegreen:'98fb98',paleturquoise:'afeeee',palevioletred:'d87093',papayawhip:'ffefd5',peachpuff:'ffdab9',peru:'cd853f',pink:'ffc0cb',plum:'dda0dd',powderblue:'b0e0e6',purple:'800080',red:'ff0000',rosybrown:'bc8f8f',royalblue:'4169e1',saddlebrown:'8b4513',salmon:'fa8072',sandybrown:'f4a460',seagreen:'2e8b57',seashell:'fff5ee',sienna:'a0522d',silver:'c0c0c0',skyblue:'87ceeb',slateblue:'6a5acd',slategray:'708090',snow:'fffafa',springgreen:'00ff7f',steelblue:'4682b4',tan:'d2b48c',teal:'008080',thistle:'d8bfd8',tomato:'ff6347',turquoise:'40e0d0',violet:'ee82ee',violetred:'d02090',wheat:'f5deb3',white:'ffffff',whitesmoke:'f5f5f5',yellow:'ffff00',yellowgreen:'9acd32'},fromCSS:function(str){if(str===null||str===window.undefined)
str="000000";if(str.charAt(0)=='#')
str=str.substr(1,6);str=str.replace(/ /g,'');str=str.toLowerCase();for(var key in Color.s_cssSimpleColors){if(str==key)
str=simpleColors[key]}
var colorDefs=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,process:function(bits){return[parseInt(bits[1]),parseInt(bits[2]),parseInt(bits[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,process:function(bits){return[parseInt(bits[1],16),parseInt(bits[2],16),parseInt(bits[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,process:function(bits){return[parseInt(bits[1]+bits[1],16),parseInt(bits[2]+bits[2],16),parseInt(bits[3]+bits[3],16)]}}];var r=0,g=0,b=0;for(var i=0;i<colorDefs.length;++i){var re=colorDefs[i].re;var processor=colorDefs[i].process;var bits=re.exec(str);if(bits){var channels=processor(bits);r=channels[0];g=channels[1];b=channels[2]}}
return new Color(r,g,b)}},prototype:{equals:function(other){return this.m_red==other.m_red&&this.m_green==other.m_green&&this.m_blue==other.m_blue&&this.m_alpha==other.m_alpha},clone:function(){return new Color(this.m_red,this.m_green,this.m_blue,this.m_alpha)},toHSV:function(){var h,s,v,cmax,cmin;h=s=v=cmax=cmin=0;var r,g,b;r=1.0*this.m_red;g=1.0*this.m_green;b=1.0*this.m_blue;if(r>=g)cmax=r;else cmax=g;if(b>cmax)cmax=b;if(r<=g)cmin=r;else cmin=g;if(b<cmin)cmin=b;v=cmax;var c=cmax-cmin;if(cmax==0)
s=0;else
s=(c/cmax)*100.0;if(s!=0){if(r==cmax){h=(g-b)/c}else
{if(g==cmax){h=2.0+(b-r)/c}else
{if(b==cmax)
h=4.0+(r-g)/c}}
h=h*60.0;if(h<0)
h=h+360.0}
h=Math.min(360,Math.max(0,Math.round(h)));s=Math.min(100,Math.max(0,Math.round(s)));v=Math.min(100,Math.max(0,Math.round((v*100.0)/255.0)));return[h,s,v]},toHex:function(alpha){var hex="0123456789abcdef";var res="#";res+=hex.charAt(Math.floor(this.m_red/16));res+=hex.charAt(this.m_red%16);res+=hex.charAt(Math.floor(this.m_green/16));res+=hex.charAt(this.m_green%16);res+=hex.charAt(Math.floor(this.m_blue/16));res+=hex.charAt(this.m_blue%16);if(alpha===true){res+=hex.charAt(Math.floor(this.m_alpha/16));res+=hex.charAt(this.m_alpha%16)}
return res},getRed:function(){return this.m_red},getGreen:function(){return this.m_green},getBlue:function(){return this.m_blue},getAlpha:function(){return this.m_alpha},setRed:function(n){this.m_red=Math.min(Math.max(0,n),255)},setGreen:function(n){this.m_green=Math.min(Math.max(0,n),255)},setBlue:function(n){this.m_blue=Math.min(Math.max(0,n),255)},setAlpha:function(n){this.m_alpha=Math.min(Math.max(0,n),255)},writeToXML:function(dom){var node=dom.createElement("color");XMLUtils.setElementText(dom,node,this.toHex());return node},getLuminosity:function(){return 0.239*this.m_red+0.686*this.m_green+0.075*this.m_blue},getSuitableTextColor:function(){if(this.getLuminosity()<=180)
return new Color(255,255,255);else
return new Color(0,0,0)},getRelativeLuminance:function(){var RsRGB=this.m_red/255.0;var GsRGB=this.m_green/255.0;var BsRGB=this.m_blue/255.0;var R=0;var G=0;var B=0;if(RsRGB<=0.03928)R=RsRGB/12.92;else R=Math.pow(((RsRGB+0.055)/1.055),2.4);if(GsRGB<=0.03928)G=GsRGB/12.92;else G=Math.pow(((GsRGB+0.055)/1.055),2.4);if(BsRGB<=0.03928)B=BsRGB/12.92;else B=Math.pow(((BsRGB+0.055)/1.055),2.4);var L=0.2126*R+0.7152*G+0.0722*B;return L},getContrastRatio:function(other){var lighter=null;var darker=null;if(this.getLuminosity()>=other.getLuminosity()){lighter=this;darker=other}else
{lighter=other;darker=this}
var L1=lighter.getRelativeLuminance();var L2=darker.getRelativeLuminance();var C=(L1+0.05)/(L2+0.05);return C}}});Color.WHITE=new Color(255,255,255);Color.BLACK=new Color(0,0,0);ColorPalette=Class.define
({ctor:function(){this.m_name="untitled";this.m_colors=new Array()},static:{createFromXMLDocument:function(dom){return ColorPalette.createFromXML(dom,XMLUtils.getRootElement(dom))},createFromXML:function(dom,node){var res=new ColorPalette();var nameTag=XMLUtils.getChildByTagName(node,"name");if(nameTag!=null)res.m_name=XMLUtils.getElementText(nameTag);var colors=XMLUtils.getChildrenByTagName(node,"color");for(var i=0;i<colors.length;++i)
res.m_colors[res.m_colors.length]=Color.createFromXML(dom,colors[i]);return res}},prototype:{addColor:function(color){this.m_colors[this.m_colors.length]=color},insertColor:function(index,color){var count=this.m_colors.length;for(var i=count;i>index;--i)
this.m_colors[i]=this.m_colors[i-1];this.m_colors[index]=color},removeColor:function(index){var res=new Array();for(var i=0;i<this.m_colors.length;++i){if(i!=index)
res[res.length]=this.m_colors[i]}
this.m_colors=res},findColor:function(color){for(var i=0;i<this.m_colors.length;++i){if(this.m_colors[i].equals(color))
return i}
return-1},toParam:function(){var res="";for(var i=0;i<this.m_colors.length;++i){if(i!=0)res+=";";res+=escape(this.m_colors[i].toHex())}
return res},getName:function(){return this.m_name},getColorCount:function(){return this.m_colors.length},getColorAt:function(index){return this.m_colors[index]},writeToXMLDocument:function(){var dom=XMLUtils.createDocument();dom.appendChild(this.writeToXML(dom));return dom},writeToXML:function(dom){var node=dom.createElement("color-palette");XMLUtils.setChildText(dom,node,"name",this.m_name);for(var i=0,n=this.m_colors.length;i<n;++i){var color=this.m_colors[i];node.appendChild(color.writeToXML(dom,node))}
return node}}});IDM.Font=Class.define
({ctor:function(name,module){this.m_name=name;this.m_module=module;this.m_styles=new ArrayList()},static:{STYLE_BOLD:0x1,STYLE_ITALIC:0x2,getDefault:function(){return new IDM.Font("Arial","default")},fromString:function(str){var tmp=StringUtils.explode(":",str);if(tmp.length<2)
return null;var entry=new IDM.Font(tmp[0],tmp[1]);if(tmp.length>=3){var stylesTmp=StringUtils.explode(",",tmp[2]);for(var i=0,n=stylesTmp.length;i<n;++i)
entry.m_styles.add(parseInt(stylesTmp[i]))}
return entry}},prototype:{getName:function(){return this.m_name},getModule:function(){return this.m_module},getStyles:function(){return this.m_styles},getVariant:function(styles){var font=new IDM.Font(this.m_name,this.m_module);if(JSUtils.isObject(styles)&&styles instanceof ArrayList){font.m_styles=styles}else
{var style=0;if(styles&IDM.Font.STYLE_BOLD)
style|=IDM.Font.STYLE_BOLD;if(styles&IDM.Font.STYLE_ITALIC)
style|=IDM.Font.STYLE_ITALIC;font.m_styles=new ArrayList();font.m_styles.add(style)}
return font},toString:function(){var res=this.m_name+":"+this.m_module;if(this.m_styles.getCount()!=0){res+=":";for(var i=0,n=this.m_styles.getCount();i<n;++i){if(i!=0)
res+=",";res+=this.m_styles.getAt(i)}}
return res}}});IDM.Alignment={LEFT:0x1,CENTER:0x2,RIGHT:0x4,JUSTIFY:0x8,TOP:0x100,MIDDLE:0x200,BOTTOM:0x400,TOP_LEFT:0x100|0x1,TOP_CENTER:0x100|0x2,TOP_RIGHT:0x100|0x4,TOP_JUSTIFY:0x100|0x8,MIDDLE_LEFT:0x200|0x1,MIDDLE_CENTER:0x200|0x2,MIDDLE_RIGHT:0x200|0x4,MIDDLE_JUSTIFY:0x200|0x8,BOTTOM_LEFT:0x400|0x1,BOTTOM_CENTER:0x400|0x2,BOTTOM_RIGHT:0x400|0x4,BOTTOM_JUSTIFY:0x400|0x8};IDM.Slot=Class.define
({ctor:function(obj){this.m_object=obj;this.m_funcs=new ArrayList()},static:{Callback:Class.define
({ctor:function(func){this.m_id=IDM.Slot.Callback.s_counter++;this.m_func=func},static:{s_counter:0},prototype:{getId:function(){return this.m_id},getFunction:function(){return this.m_func}}})},prototype:{getObject:function(){return this.m_object},attach:function(func){var cb=new IDM.Slot.Callback(func);this.m_funcs.add(cb);return cb.getId()},detach:function(id){for(var i=0,n=this.m_funcs.getCount();i<n;++i){var cb=this.m_funcs.getAt(i);if(cb.getId()==id){this.m_funcs.removeAt(i);return true}}
return false},trigger:function(){var args=new Array();args[0]=this;for(var i=0;i<arguments.length;++i)
args[args.length]=arguments[i];var res=window.undefined;for(var i=0,n=this.m_funcs.getCount(),a=args.length;i<n;++i){args[a]=res;var func=this.m_funcs.getAt(i).getFunction();res=func.apply(null,args)}
return res}}});IDM.MultiSlot=Class.define
({ctor:function(){IDM.MultiSlot.baseConstructor.call(this);this.m_slots=new ArrayList();this.m_triggeredSlots=new ArrayList()},inherits:IDM.Slot,prototype:{addSlot:function(slot){this.m_slots.add(slot);slot.attach(JSUtils.makeCallback(this,IDM.MultiSlot.prototype._onSlotTriggered))},getSlots:function(){return this.m_slots},_onSlotTriggered:function(slot){this.m_triggeredSlots.add(slot);var found=true;for(var i=0,n=this.m_slots.getCount();found&&i<n;++i)
found=(this.m_triggeredSlots.find(this.m_slots.getAt(i))!=-1);if(found)
this.trigger()}}});IDM.Object=Class.define
({ctor:function(){this.m_slots=new Array()},prototype:{declareSlot:function(name,slot){if(!slot)
slot=new IDM.Slot(this);this.m_slots[name]=slot},getNamedSlot:function(name){if(!this.m_slots[name])
return null;return this.m_slots[name]}}});function NodeRef(elt){if(elt.id===null||elt.id==window.undefined||elt.id===""){elt.id="NodeRef_"+NodeRef.sCurrentIndex;elt.NodeRefed=true;NodeRef.sCurrentIndex++}
this.m_id=elt.id}
NodeRef.sCurrentIndex=0;NodeRef.create=function(element){return new NodeRef(element)}
NodeRef.acquire=function(element){element.NodeRefed=true;return new NodeRef(element)}
NodeRef.acquireOrCreate=function(element){if(element.id&&element.id.length>0)
return NodeRef.acquire(element);else
return NodeRef.create(element)}
NodeRef.prototype.getElement=function(){return document.getElementById(this.m_id)}
HTMLUtils={moveElement:function(elt,x,y,w,h){if(w==window.undefined&&h==window.undefined){elt.style.left=Math.round(x.x)+"px";elt.style.top=Math.round(x.y)+"px";elt.style.width=Math.max(0,Math.round(y.width))+"px";elt.style.height=Math.max(0,Math.round(y.height))+"px"}else
{elt.style.left=Math.round(x)+"px";elt.style.top=Math.round(y)+"px";elt.style.width=Math.max(0,Math.round(w))+"px";elt.style.height=Math.max(0,Math.round(h))+"px"}},getElementScrollPos:function(elt){var x=0,y=0;if(elt.scrollLeft||elt.scrollTop){x=elt.scrollLeft;y=elt.scrollTop}
return new Point(x,y)},setElementScrollPos:function(elt,pt){elt.scrollLeft=pt.x;elt.scrollTop=pt.y},getElementRect:function(elt){var pos=HTMLUtils.getElementPos(elt);var size=HTMLUtils.getElementSize(elt);return new Rect(pos.x,pos.y,pos.x+size.width,pos.y+size.height)},getElementPos:function(elt){var x=0,y=0;if(elt.offsetParent){var offsetElt=elt,scrollElt=elt;while(offsetElt!=null||scrollElt!=null){if(offsetElt){x+=(offsetElt.offsetLeft?parseInt(offsetElt.offsetLeft):0)
y+=(offsetElt.offsetTop?parseInt(offsetElt.offsetTop):0);offsetElt=offsetElt.offsetParent}
if(scrollElt){if(scrollElt.scrollLeft)x-=scrollElt.scrollLeft;if(scrollElt.scrollTop)y-=scrollElt.scrollTop;scrollElt=scrollElt.parentNode}}}else
{x=elt.x;y=elt.y}
if(isNaN(x))x=0;if(isNaN(y))y=0;var scrollPos=HTMLUtils.getScrollPos();x+=scrollPos.x;y+=scrollPos.y;return new Point(x,y)},setElementPos:function(elt,pos){var x=pos.x,y=pos.y;if(isNaN(x))x=0;if(isNaN(y))y=0;elt.style.left=Math.round(x)+"px";elt.style.top=Math.round(y)+"px"},getElementInnerPos:function(elt){var x=parseInt(elt.style.left);var y=parseInt(elt.style.top);if(isNaN(x))
x=parseInt(elt.offsetLeft);if(isNaN(y))
y=parseInt(elt.offsetTop);if(isNaN(x))x=0;if(isNaN(y))y=0;return new Point(x,y)},getElementSize:function(elt){var w=parseInt(elt.offsetWidth);var h=parseInt(elt.offsetHeight);if((isNaN(w)&&isNaN(h)||(!w&&!h))&&elt.style){w=parseInt(elt.style.width);h=parseInt(elt.style.height)}
if(isNaN(w))w=0;if(isNaN(h))h=0;return new Size(w,h)},getElementBorders:function(elt){var rect=new Rect();var borderTop=HTMLUtils.getCurrentStyle(elt,"border-top-width");if(borderTop)rect.y1=parseInt(borderTop);var borderBottom=HTMLUtils.getCurrentStyle(elt,"border-bottom-width");if(borderBottom)rect.y2=parseInt(borderBottom);var borderLeft=HTMLUtils.getCurrentStyle(elt,"border-left-width");if(borderLeft)rect.x1=parseInt(borderLeft);var borderRight=HTMLUtils.getCurrentStyle(elt,"border-right-width");if(borderRight)rect.x2=parseInt(borderRight);return rect},getElementOuterMargins:function(elt){var rect=new Rect();var marginTop=HTMLUtils.getCurrentStyle(elt,"margin-top");if(marginTop)rect.y1=parseInt(marginTop);var marginBottom=HTMLUtils.getCurrentStyle(elt,"margin-bottom");if(marginBottom)rect.y2=parseInt(marginBottom);var marginLeft=HTMLUtils.getCurrentStyle(elt,"margin-left");if(marginLeft)rect.x1=parseInt(marginLeft);var marginRight=HTMLUtils.getCurrentStyle(elt,"margin-right");if(marginRight)rect.x2=parseInt(marginRight);return rect},getElementPadding:function(elt){var rect=new Rect();var paddingTop=HTMLUtils.getCurrentStyle(elt,"padding-top");if(paddingTop)rect.y1=parseInt(paddingTop);var paddingBottom=HTMLUtils.getCurrentStyle(elt,"padding-bottom");if(paddingBottom)rect.y2=parseInt(paddingBottom);var paddingLeft=HTMLUtils.getCurrentStyle(elt,"padding-left");if(paddingLeft)rect.x1=parseInt(paddingLeft);var paddingRight=HTMLUtils.getCurrentStyle(elt,"padding-right");if(paddingRight)rect.x2=parseInt(paddingRight);return rect},getElementOuterSize:function(elt){var size=HTMLUtils.getElementSize(elt);var marginRect=HTMLUtils.getElementOuterMargins(elt);size.width+=marginRect.x1+marginRect.x2;size.height+=marginRect.y1+marginRect.y2;return size},setElementSize:function(elt,size){var w=size.width;var h=size.height;if(isNaN(w)||w<0)w=0;if(isNaN(h)||h<0)h=0;elt.style.width=Math.round(w)+"px";elt.style.height=Math.round(h)+"px"},setElementWidth:function(elt,width){if(isNaN(width))width=0;elt.style.width=Math.round(width)+"px"},setElementHeight:function(elt,height){if(isNaN(height))height=0;elt.style.height=Math.round(height)+"px"},getScrollPos:function(){var scrollX=0,scrollY=0;if(self.pageXOffset)
scrollX=self.pageXOffset;else if(document.documentElement&&document.documentElement.scrollLeft)
scrollX=document.documentElement.scrollLeft;else if(document.body)
scrollX=document.body.scrollLeft;if(self.pageYOffset)
scrollY=self.pageYOffset;else if(document.documentElement&&document.documentElement.scrollTop)
scrollY=document.documentElement.scrollTop;else if(document.body)
scrollY=document.body.scrollTop;return new Point(scrollX,scrollY)},getWindowInnerSize:function(){var x=0,y=0;if(self.innerHeight){x=self.innerWidth;y=self.innerHeight}else if(document.documentElement&&document.documentElement.clientHeight){x=document.documentElement.clientWidth;y=document.documentElement.clientHeight}else if(document.body){x=document.body.clientWidth;y=document.body.clientHeight}
return new Size(x,y)},getDocumentSize:function(){var w=0,h=0;if(document.documentElement){w=parseInt(document.documentElement.scrollWidth);h=parseInt(document.documentElement.scrollHeight)}
if(isNaN(w))w=0;if(isNaN(h))h=0;return new Size(w,h)},setElementOpacity:function(elt,op){elt.style.opacity=op/100.0;elt.style["-moz-opacity"]=op/100.0;if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_IE){var filterStr=HTMLUtils.getCurrentStyle(elt,"filter");var filters=StringUtils.explode(" ",filterStr);var alphaFound=false;for(var i=0,n=filters.length;i<n;++i){var filter=filters[i];if(filter.toLowerCase().indexOf("alphaimageloader")!=-1){return}else if(filter.toLowerCase().indexOf("alpha")!=-1){alphaFound=true;filters[i]="progid:DXImageTransform.Microsoft.Alpha(opacity="+Math.round(op);+")"}}
if(!alphaFound)
filters[filters.length]="progid:DXImageTransform.Microsoft.Alpha(opacity="+Math.round(op);+")";elt.style.filter=StringUtils.implode(" ",filters)}},setElementVisible:function(elt,show){elt.style.visibility=(show?"visible":"hidden")},isElementVisible:function(elt){return elt.style.visibility!="hidden"},setElementDisplay:function(elt,show){elt.style.display=(show?"block":"none")},isElementDisplayed:function(elt){return HTMLUtils.getCurrentStyle(elt,"display")!="none"},setElementInlineBlock:function(elt){if((JSUtils.getNavigator()==JSUtils.NAVIGATOR_MOZILLA)&&(JSUtils.getNavigatorVersion()<3))
elt.style.display="-moz-inline-box";else
elt.style.display="inline-block";elt.style.verticalAlign="middle"},getBackgroundPosition:function(elt){var bkgndPosStr=HTMLUtils.getCurrentStyle(elt,"background-position");var tmp=StringUtils.explode(" ",bkgndPosStr);if(tmp.length!=2)
return new Point(0,0);var x=parseInt(tmp[0].replace("px",""),10);if(isNaN(x))x=0;var y=parseInt(tmp[1].replace("px",""),10);if(isNaN(y))y=0;return new Point(x,y)},setBackgroundPosition:function(elt,pos){elt.style.backgroundPosition=Math.round(pos.x)+"px "+Math.round(pos.y)+"px"},s_emToPxFactor:null,emToPx:function(em){if(HTMLUtils.s_emToPxFactor===null){var elt=document.createElement("div");elt.style.position="absolute";elt.style.left="-1000px";elt.style.top="-1000px";elt.style.height="1em";elt.style.width="1em";elt.appendChild(document.createTextNode("i"));document.body.appendChild(elt);var size=HTMLUtils.getElementSize(elt);document.body.removeChild(elt);HTMLUtils.s_emToPxFactor=size.height}
return Math.round(HTMLUtils.s_emToPxFactor*em)},getCurrentStyle:function(elt,cssProp){if(elt.currentStyle){while(cssProp.indexOf('-')!=-1){var chr=cssProp.charAt(cssProp.indexOf('-')+1);cssProp=cssProp.replace(/-\S{1}/,chr.toUpperCase())}
return elt.currentStyle[cssProp]}else if(window.getComputedStyle){var style=window.getComputedStyle(elt,null);return style.getPropertyValue(cssProp)}
return null},flipClass:function(el,class1,class2){if(el!=null){if(el.getAttribute('class')==class1||el.getAttribute('className')==class1){el.setAttribute("class",class2);el.setAttribute("className",class2)}else
{el.setAttribute("class",class1);el.setAttribute("className",class1)}}},setClass:function(el,class_name){if(el!=null){el.setAttribute("class",class_name);el.setAttribute("className",class_name)}},setElementDisabled:function(el){if(!JSUtils.isObject(el))
el=window.document.getElementById(el);el.setAttribute("disabled","disabled");if(el.getAttribute("enabled")!=null&&el.getAttribute("enabled")!=""){el.removeAttribute("enabled")}
HTMLUtils.addStyleClass(el,"disabled")},setElementEnabled:function(el){if(!JSUtils.isObject(el))
el=window.document.getElementById(el);el.setAttribute("enabled","enabled");if(el.getAttribute("disabled")!=null&&el.getAttribute("disabled")!=""){el.removeAttribute("disabled")}
HTMLUtils.removeStyleClass(el,"disabled")},isEnabled:function(el){if(!JSUtils.isObject(el))
el=window.document.getElementById(el);return el.getAttribute("enabled")!=null?true:false},isDisabled:function(el){if(!JSUtils.isObject(el))
el=window.document.getElementById(el);return el.getAttribute("disabled")!=null?true:false},setFloat:function(el,position){if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_IE)
el.style.styleFloat=position;else
el.style.cssFloat=position},computeTextSize:function(text,maxWidth,elt,className){if(!maxWidth)
maxWidth=10000;else
maxWidth=Number(maxWidth);var ctmp=document.createElement("div");if(!window.ActiveXObject)
ctmp.style.display="table";ctmp.style.width="1px";var tmp=document.createElement("div");if(window.ActiveXObject)
tmp.style.display="inline";else
tmp.style.display="table-cell";if(elt){var s=elt.style;if(elt.currentStyle)
s=elt.currentStyle;else if(document.defaultView&&document.defaultView.getComputedStyle)
s=document.defaultView.getComputedStyle(elt,'');if(s){className=elt.className||"";var parent=elt.parentNode;while(parent!=null){if(parent.className)
className=parent.className+" "+className;parent=parent.parentNode}
tmp.className=className;try{tmp.style.fontFamily=s.fontFamily}catch(e){}
try{tmp.style.fontWeight=s.fontWeight}catch(e){}
try{tmp.style.fontStyle=s.fontStyle}catch(e){}
try{tmp.style.fontSize=s.fontSize}catch(e){}}else
{tmp.className=elt}}
if(className)
tmp.className=className;ctmp.style.visibility="hidden";tmp.style.visibility="hidden";tmp.innerHTML=StringUtils.replaceString(text,' :','&#160;:');tmp.style.overflow="hidden";document.body.appendChild(tmp);var size=HTMLUtils.getElementSize(tmp);if(size.width>maxWidth){tmp.style.width=maxWidth+"px";size=HTMLUtils.getElementSize(tmp)}
size.width*=1.1;tmp.parentNode.removeChild(tmp);return size},removeAllChildren:function(root){root.innerHTML=""},removeAllTextNodes:function(root){var children=root.childNodes;for(var i=children.length-1;i>=0;--i){var child=children[i];if(child.nodeType==3)
root.removeChild(child)}},setElementText:function(elt,text){HTMLUtils.removeAllChildren(elt);elt.appendChild(document.createTextNode(text))},getElementText:function(elt){return XMLUtils.getElementText(elt)},getChildElement:function(node,tagName,className,recursive){var children=node.childNodes;if(!children)return null;if(tagName)
tagName=tagName.toLowerCase();for(var i=0;i<children.length;++i){var child=children[i];if(child.tagName&&(tagName==window.undefined||tagName==null||child.tagName.toLowerCase()==tagName)){if(className===window.undefined||className===null||JSUtils.arrayContains(StringUtils.explode(" ",child.className),className))
return child}
if(recursive&&child.tagName){var tmp=HTMLUtils.getChildElement(child,tagName,className,true);if(tmp!=null)
return tmp}}
return null},getFirstChild:function(node,tagName,className){var children=HTMLUtils.getChildrenElements(node,tagName,className);return(children.length!=0?children[0]:null)},getChildrenElements:function(node,tagName,className){var children=node.childNodes;if(!children)return new Array();var res=new Array();if(tagName)
tagName=tagName.toLowerCase();for(var i=0;i<children.length;++i){var child=children[i];if(child.tagName&&(!tagName||child.tagName.toLowerCase()==tagName)){if(className===window.undefined||JSUtils.arrayContains(StringUtils.explode(" ",child.className),className))
res[res.length]=child}}
return res},addStyleClass:function(elt,className){var x=(elt.className?StringUtils.explode(" ",elt.className):[]);if(!JSUtils.arrayContains(x,className))
x=JSUtils.arrayAdd(x,className);elt.className=StringUtils.implode(" ",x)},removeStyleClass:function(elt,className){var x=(elt.className?StringUtils.explode(" ",elt.className):[]);if(className.length>=1&&className.charAt(className.length-1)=="*"){var y=[];var prefix=className.substring(0,className.length-1);for(var i=0,n=x.length;i<n;++i){if(!StringUtils.startsWith(x[i],prefix))
y[y.length]=x[i]}
x=y}else
{x=JSUtils.arrayRemove(x,className)}
elt.className=StringUtils.implode(" ",x)},hasStyleClass:function(elt,className){if(!elt.className)
return false;var x=StringUtils.explode(" ",elt.className);return JSUtils.arrayContains(x,className)},getStyleClasses:function(elt){if(!elt.className)
return[];return StringUtils.explode(" ",elt.className)},setStyleClasses:function(elt,classes){elt.className=StringUtils.implode(" ",classes)},getChildWithClass:function(root,className,tagName){var elts=root.getElementsByTagName(tagName?tagName:"div");var count=elts.length;for(var i=0;i<count;++i){var elt=elts[i];if(CSSUtils.selectorMatchesElement(elt,className))
return elt}
return null},getChildWithName:function(root,name,tagName){var elts=root.getElementsByTagName(tagName?tagName:"div");var count=elts.length;for(var i=0;i<count;++i){var elt=elts[i];var nam="";for(var ce=elt;ce!=root;ce=ce.parentNode){var en=ce.name;if(en!=window.undefined&&en.length!="")nam="."+en+nam}
if(nam!="")
nam=nam.substring(1);if(nam==name)
return elt}
return null},removeSelectOptionByValue:function(sel,value){var options=sel.getElementsByTagName("option");for(var i=0;i<options.length;++i){if(options[i].value==value){options[i].parentNode.removeChild(options[i]);return}}},removeSelectOptionByIndex:function(sel,index){var options=sel.getElementsByTagName("option");for(var i=0;i<options.length;++i){if(i==index){options[i].parentNode.removeChild(options[i]);return}}},getParentElement:function(node){while(node.nodeType!=1)
node=node.parentNode;return node},hasParent:function(node,parent){if(!node)return false;while(node.parentNode!=null){node=node.parentNode;if(node==parent)
return true}
return false},importNode:function(newDoc,node,allChildren){if(window.ActiveXObject){switch(node.nodeType){case 1:var newNode=newDoc.createElement(node.nodeName);if(node.attributes&&node.attributes.length>0){for(var i=0,il=node.attributes.length;i<il;++i)
newNode.setAttribute(node.attributes[i].nodeName,node.getAttribute(node.attributes[i].nodeName))}
if(allChildren&&node.childNodes&&node.childNodes.length>0){for(var i=0,il=node.childNodes.length;i<il;++i)
newNode.appendChild(HTMLUtils.importNode(newDoc,node.childNodes[i],allChildren))}
return newNode;case 3:case 4:case 8:return newDoc.createTextNode(node.nodeValue);default:return null}}else
{return newDoc.importNode(node,allChildren)}},gFakeFocusObject:null,killFocus:function(elt){if(HTMLUtils.gFakeFocusObject==null){var obj=document.createElement("input");obj.type="text";obj.style.position="absolute";obj.style.width=obj.style.height="10px";obj.style.left="-1000px";document.body.appendChild(obj);HTMLUtils.gFakeFocusObject=NodeRef.create(obj)}
var obj=HTMLUtils.gFakeFocusObject.getElement();if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_IE){obj.style.position="absolute";obj.style.top=(document.documentElement.scrollTop+document.body.scrollTop)+"px"}else
{obj.style.position="fixed";obj.style.top="0px"}
obj.focus()},hasFocus:function(elt){if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_IE){try
{var result=!!(elt.hasFocus||elt==document.activeElement);if(result)return result}
catch(ex){}}
if(elt.hasFocus!==window.undefined){try
{return elt.hasFocus()}
catch(ex){}}
try
{var sel=window.getSelection().getRangeAt(0);if(!sel.collapsed)
return false;var sel2=document.createRange();sel2.setStartBefore(elt);sel2.setEndBefore(elt);var result=true;result=(result&&sel.startOffset==sel2.startOffset);result=(result&&sel.endOffset==sel2.endOffset);return result}
catch(ex){}
if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_OPERA){return!!(elt.selectionStart||elt.selectionEnd)}
return false},initGetFocus:function(){if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_MOZILLA){var xulIframe=document.getElementById("IDM_HTMLUtils_getFocus_XULIframe");if(!xulIframe){xulIframe=document.createElement("iframe");xulIframe.style.position="absolute";xulIframe.id="IDM_HTMLUtils_getFocus_XULIframe";try
{xulIframe.src="data:application/vnd.mozilla.xul+xml,<window/>"}
catch(ex){}
HTMLUtils.setElementSize(xulIframe,new Size(10,10));HTMLUtils.setElementPos(xulIframe,new Point(-100,-100));document.body.appendChild(xulIframe)}}},getFocus:function(){if(document.activeElement){return document.activeElement}else
{try
{HTMLUtils.initGetFocus();var xulIframe=document.getElementById("IDM_HTMLUtils_getFocus_XULIframe");var node=xulIframe.contentDocument.commandDispatcher.focusedElement;while(node!=null){if(node.nodeType==Node.ELEMENT_NODE)
return node;node=node.parentNode}}
catch(ex){}
var elts=JSUtils.arrayMerge
(document.getElementsByTagName("input"),JSUtils.arrayMerge
(document.getElementsByTagName("textarea"),document.getElementsByTagName("button")));for(var i=0;i<elts.length;++i){var elt=elts[i];if(elt.tagName.toLowerCase()=="textarea"||(elt.tagName.toLowerCase()=="input"&&(elt.type==""||elt.type=="text"))){if(HTMLUtils.hasFocus(elt))
return elt}}}
return null},fixPNGImage:function(imgElt,stretch,force){if(window.ActiveXObject&&(force||!window.XMLHttpRequest)){fnFixPng(imgElt,window.undefined,window.undefined,stretch===window.undefined?false:(stretch?true:false));return true}
return false},setPNGBackground:function(elt,url){if(window.ActiveXObject&&!window.XMLHttpRequest){elt.style.backgroundImage="none";elt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader"
+"(src=\""+url+"\", sizingMethod=\"crop\")"}else
{elt.style.backgroundImage="url("+url+")"}},redirect:function(doc,url){if(doc===null||doc===window.undefined)
doc=document;if(JSUtils.isObject(url))
doc.location.href=url.toString();else
doc.location.href=url},createEventLayer:function(){var div=document.createElement("div");div.style.position="absolute";HTMLUtils.setElementPos(div,new Point(0,0));HTMLUtils.setElementSize(div,HTMLUtils.getDocumentSize());document.body.appendChild(div);HTMLUtils.setupNullEvents(div);return div},setupLineDiv:function(elt){if(window.ActiveXObject){elt.style.fontSize="1px";var img=document.createElement("img");img.src="/styles/image.php?path=page/spacer.png";img.width=1;img.height=1;elt.appendChild(img)}},setInnerHTML:function(elt,str){if(/Mozilla\/5\.0/.test(navigator.userAgent)){var r=elt.ownerDocument.createRange();r.selectNodeContents(elt);r.deleteContents();var df=r.createContextualFragment(str);elt.appendChild(df)}else
{elt.innerHTML=str}},setupNullEvents:function(elt,fct){if(fct==window.undefined)
fct=JSUtils.IGNORE_EVENT_FUNCTION;elt.onclick=fct;elt.onmousedown=fct;elt.onmouseup=fct;elt.onmouseover=fct;elt.onmouseout=fct;elt.onmousemove=fct;elt.onkeydown=fct;elt.onkeyup=fct},openWindow:function(url,name,size){if(!name)
name="Window_"+NumberUtils.randomBigNumber();else
name=StringUtils.replaceString(name,"-","_");var options=[];options["toolbar"]="no";options["menubar"]="no";options["status"]="no";options["directories"]="no";options["location"]="no";options["resizable"]="yes";options["scrollbars"]="yes";if(size){options["width"]=size.width;options["height"]=size.height}
if(JSUtils.isObject(url))
url=url.toString();return window.open(url,name,StringUtils.joinMap(options,"=",","))},s_onLoadFunctions:[],s_onPreLoadFunctions:[],s_onPostLoadFunctions:[],s_onLoadTriggered:false,addOnLoadFunction:function(fct){HTMLUtils.s_onLoadFunctions[HTMLUtils.s_onLoadFunctions.length]=fct},addOnPreLoadFunction:function(fct){HTMLUtils.s_onPreLoadFunctions[HTMLUtils.s_onPreLoadFunctions.length]=fct},addOnPostLoadFunction:function(fct){HTMLUtils.s_onPostLoadFunctions[HTMLUtils.s_onPostLoadFunctions.length]=fct},triggerOnLoad:function(){for(var i=0,n=HTMLUtils.s_onPreLoadFunctions.length;i<n;++i)
HTMLUtils.s_onPreLoadFunctions[i]();for(var i=0,n=HTMLUtils.s_onLoadFunctions.length;i<n;++i)
HTMLUtils.s_onLoadFunctions[i]();HTMLUtils.s_onLoadTriggered=true;HTMLUtils.s_onLoadFunctions=[];for(var i=0,n=HTMLUtils.s_onPostLoadFunctions.length;i<n;++i)
HTMLUtils.s_onPostLoadFunctions[i]();HTMLUtils.s_onPostLoadFunctions=[]},setOnUnloadFunction:function(fct){var prev=window.onbeforeunload;if(fct==null){document.body.onbeforeunload=window.onbeforeunload=null}else
{document.body.onbeforeunload=window.onbeforeunload=function(e){var ev=DOMEventUtils.getEvent(e);DOMEventUtils.stopPropagation(ev);var res=fct();if(res==null||res==window.undefined||res=="")
return window.undefined;else
return""+res}}
return prev},addOnElementPositionedFunction:function(elt,fct){var interval=null;var checkPos=function(){var eltPos=HTMLUtils.getElementPos(elt);var eltSize=HTMLUtils.getElementSize(elt);if((eltPos.x!=0||eltPos.y!=0)&&(eltSize.width!=0||eltSize.height!=0)){clearInterval(interval);fct()}}
interval=setInterval(checkPos,100)},s_uniqueIdSeq:0,generateUniqueId:function(){HTMLUtils.s_uniqueIdSeq++;return"IDMElt_"+HTMLUtils.s_uniqueIdSeq},createHiddenInput:function(name,value,doc){if(!doc)
doc=document;var inputElt=doc.createElement("input");inputElt.type="hidden";inputElt.name=name;inputElt.value=value;return inputElt},createCheckbox:function(){var elt=null;if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_IE){var tmp=document.createElement("div");tmp.innerHTML='<input type="checkbox"/>';elt=tmp.childNodes[0]}else
{var elt=document.createElement("input");elt.type="checkbox"}
elt.style.verticalAlign="middle";elt.className="clickable-control";return elt},createRadio:function(groupName,initialChecked){var elt=null;if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_IE){var tmp=document.createElement("div");tmp.innerHTML='<input type="radio" name="'+StringUtils.escapeXML(groupName)+'"/>';elt=tmp.childNodes[0]}else
{elt=document.createElement("input");elt.type="radio";elt.name=groupName}
elt.style.verticalAlign="middle";if(initialChecked)
elt.defaultChecked=elt.checked=initialChecked;return elt},createRadioWithLabel:function(groupName,label,initialChecked){var radioElt=HTMLUtils.createRadio(groupName,initialChecked);var labelElt=HTMLUtils.createLabel(radioElt,label,false);var elt=document.createElement("span");elt.appendChild(radioElt);elt.appendChild(document.createTextNode("\u00A0"));elt.appendChild(labelElt);labelElt.className="clickable-control";return[elt,radioElt]},createCheckboxWithLabel:function(label){var checkElt=HTMLUtils.createCheckbox();var labelElt=HTMLUtils.createLabel(checkElt,label,false);var elt=document.createElement("span");elt.appendChild(checkElt);elt.appendChild(document.createTextNode("\u00A0"));elt.appendChild(labelElt);labelElt.className="clickable-control";return[elt,checkElt]},createSelectElement:function(){var elt=document.createElement("select");elt.className="select-control";return elt},createListElement:function(){var elt=document.createElement("select");elt.multiple=true;elt.className="list-control";return elt},createTextAreaElement:function(initialValue,name){var elt=document.createElement("textarea");elt.cols=30;elt.rows=3;elt.className="input-control";if(name)elt.name=name;if(initialValue)elt.value=initialValue;return elt},createInputElementWithLabel:function(label,initialValue,size,name){var inputElt=HTMLUtils.createInputElement(initialValue,size,name);var labelElt=HTMLUtils.createLabel(inputElt,label,false);var elt=document.createElement("span");elt.appendChild(labelElt);elt.appendChild(document.createTextNode("\u00A0"));elt.appendChild(inputElt);return[elt,inputElt]},createInputElement:function(initialValue,size,name){var elt=document.createElement("input");elt.type="text";elt.size=(size?size:30);elt.className="input-control";elt.style.verticalAlign="middle";if(name)elt.name=name;if(initialValue)elt.value=initialValue;return elt},createLabel:function(forElt,text,isHTML){if(isHTML==null||isHTML==window.undefined)
isHTML=false;if(forElt.id===window.undefined||forElt.id===null||JSUtils.toString(forElt.id).length==0)
forElt.id=HTMLUtils.generateUniqueId();var labelElt=document.createElement("label");labelElt.htmlFor=forElt.id;labelElt.style.verticalAlign="middle";if(isHTML){labelElt.innerHTML=text}else
{text=StringUtils.replaceString(text," ","\u00A0");labelElt.appendChild(document.createTextNode(text))}
return labelElt},createButton:function(text,clickAction){var elt=document.createElement("button");elt.className="button-control";elt.appendChild(document.createTextNode(text));if(clickAction)
elt.onclick=clickAction;return elt},createMultiTextElement:function(parent,contents,isHTML,classNamePrefix,count,elt){if(elt===null||elt===window.undefined)
elt="div";var res=[];for(var i=1;i<count;++i){var textElt=document.createElement(elt);textElt.className=classNamePrefix+i;if(isHTML)
textElt.innerHTML=contents;else
textElt.appendChild(document.createTextNode(contents));if(parent)
parent.appendChild(textElt);res[res.length]=textElt}
return res},checkboxSelectionHelper:function(prefix,checked,mode){if(mode===window.undefined||mode===null)
mode="id";var inputs=document.getElementsByTagName("input");for(var i=0,n=inputs.length;i!=n;++i){var input=inputs[i];var id="";if(mode=="class")
id=input.className;else if(mode=="name")
id=input.name;else
id=input.id;if(!prefix||id.substr(0,prefix.length)==prefix)
input.defaultChecked=input.checked=(checked?true:false)}},createTable:function(tableData,forCtlAlign){var table=document.createElement("table");table.cellSpacing=0;table.cellPadding=0;table.border=0;table.style.borderSpacing="0px";table.style.borderCollapse="collapse";if(forCtlAlign)
table.className="idm-control-alignment";for(var r=0,nr=tableData.length;r<nr;++r){var row=table.insertRow(-1);var rowData=tableData[r];for(var c=0,nc=rowData.length;c<nc;++c){var cell=row.insertCell(c);var cellData=rowData[c];if(cellData.tagName)
cell.appendChild(cellData);else
cell.appendChild(document.createTextNode(JSUtils.toString(cellData)))}}
return table},createFieldSet:function(legend,legendIsHTML){var frameElt=document.createElement("fieldset");var legendElt=document.createElement("legend");frameElt.appendChild(legendElt);if(!JSUtils.isString(legend)){legendElt.appendChild(legend)}else
{if(legendIsHTML)
legendElt.innerHTML=legend;else
legendElt.appendChild(document.createTextNode(legend))}
return frameElt},createFormattedPara:function(contents){var cts=StringUtils.escapeXML(contents);cts=StringUtils.replaceString(cts,"\n","<br/>");cts=StringUtils.replaceStringRegExp(cts,"\\[b\\](.*?)\\[/b\\]","<strong>$1</strong>");cts=StringUtils.replaceStringRegExp(cts,"\\[i\\](.*?)\\[/i\\]","<em>$1</em>");cts=StringUtils.replaceStringRegExp(cts," ([:;,\?!\(])","&#160;$1");var p=document.createElement("p");p.innerHTML=cts;return p},createElement:function(name,contents,doc){if(!doc)
doc=document;var elt=doc.createElement(name);if(contents){if(contents.tagName)
elt.appendChild(contents);else
elt.appendChild(document.createTextNode(JSUtils.toString(contents)))}
return elt},setupAutoExpandTextArea:function(elt,maxRows){elt.onkeypress=function(e){var ev=DOMEventUtils.getEvent(e);HTMLUtils.autoExpandTextArea(this,maxRows)}
HTMLUtils.autoExpandTextArea(elt,maxRows)},autoExpandTextArea:function(elt,maxRows){if(maxRows===null||maxRows===window.undefined||maxRows<1)
maxRows=0;var str=""+elt.value;str=StringUtils.replaceString(str,"\r\n","\n");str=StringUtils.replaceString(str,"\r","\n");var lines=StringUtils.explode("\n",str,true);elt.rows=Math.min(Math.max(elt.rows,lines.length+2),maxRows==0?4242:maxRows)},allowTabInTextArea:function(elt){var fct=JSUtils.makeCallbackEvent(null,HTMLUtils.allowTabInTextArea_EventFunction,elt);elt.onkeydown=fct;elt.onkeyup=fct;elt.onkeypress=fct},allowTabInTextArea_EventFunction:function(obj,ev){var keyCode=DOMEventUtils.getKeyCode(ev);if(keyCode==9){if(ev.type=="keydown"){if(obj.setSelectionRange){var s=obj.selectionStart;var e=obj.selectionEnd;obj.value=obj.value.substring(0,s)+"\t"+obj.value.substr(e);obj.setSelectionRange(s+1,s+1);obj.focus()}else if(obj.createTextRange){document.selection.createRange().text="\t";obj.onblur=function(){this.focus();this.onblur=null}}}
return false}
return true},disableTextSelectionInElement:function(elt){elt.onselectstart=JSUtils.IGNORE_EVENT_FUNCTION;elt.onmousedown=JSUtils.IGNORE_EVENT_FUNCTION},getIFrameDocument:function(iframeElt){if(iframeElt.contentWindow)
return iframeElt.contentWindow.document;else
return iframeElt.contentDocument},setIFrameOnLoadEvent:function(iframeElt,func){var iframeDoc=HTMLUtils.getIFrameDocument(iframeElt);function eventPush(obj,evt,handler){if(obj.addEventListener)
obj.addEventListener(evt,handler,false);else if(obj.attachEvent)
obj.attachEvent('on'+evt,handler)}
eventPush(iframeElt,'load',func)},openDownloadLink:function(url){var frameElt=document.createElement("iframe");frameElt.style.position="absolute";HTMLUtils.setElementPos(frameElt,new Point(-1000,-1000));HTMLUtils.setElementSize(frameElt,new Size(100,100));document.body.appendChild(frameElt);frameElt.src=url.toString()}};XMLUtils={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12,createDocumentFromString:function(str){var xmlDoc=null;if(window.ActiveXObject){try
{xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async="false";xmlDoc.loadXML(str)}
catch(e){return null}}else if(window.DOMParser){try
{xmlDoc=(new DOMParser()).parseFromString(str,"text/xml");var root=XMLUtils.getRootElement(xmlDoc);if(root.tagName=="parsererror")
return null}
catch(e){return null}}else if(window.XMLHttpRequest){var url="data:text/xml;charset=utf-8,"+encodeURIComponent(str);try
{var request=new XMLHttpRequest();request.open("GET",url,false);request.send(null);return request.responseXML}
catch(e){return null}}else
{return null}
return xmlDoc},createDocument:function(){if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLDOM")}else
{var doc=new DOMParser().parseFromString("<?xml version='1.0' encoding='UTF-8'?><dummy/>","application/xml");doc.removeChild(doc.documentElement);return doc}},isValidXMLString:function(str,standalone){if(!standalone)
str="<root>"+str+"</root>";return(XMLUtils.createDocumentFromString(str)!=null)},documentToString:function(doc){if(!doc)
return null;if(window.XMLSerializer)
return(new XMLSerializer()).serializeToString(doc);else if(doc.xml)
return doc.xml;else
return null},nodeToString:function(doc,node){if(window.XMLSerializer)
return(new XMLSerializer()).serializeToString(node);else if(node.xml)
return node.xml;else
return null},getNodeType:function(node){return node.nodeType},getRootElement:function(doc){if(!doc)
return null;return doc.documentElement},removeAllChildren:function(root){var children=root.childNodes;if(!children)return;for(var i=0,count=children.length;i<count;++i)
root.removeChild(root.childNodes[0])},nodeHasAttribute:function(node,attrName){if(node.hasAttribute)
return node.hasAttribute(attrName);else
return node.getAttribute(attrName)!=null},getChildByTagName:function(node,tagName){var nodes=XMLUtils.getChildrenByTagName(node,tagName);if(nodes.length!=0)
return nodes[0];else
return null},getChildrenByTagName:function(node,tagName){if(node==null||!node.childNodes)
return[];if(tagName=="image"&&JSUtils.getNavigator()==JSUtils.NAVIGATOR_SAFARI)
tagName="img";var children=node.childNodes;var nodes=[];for(var i=0;i<children.length;++i){var child=children[i];if(child.tagName&&child.tagName==tagName)
nodes[nodes.length]=child}
return nodes},getElementText:function(node){var children=node.childNodes;var text="";for(var i=0;i<children.length;++i){var child=children[i];if(child.nodeValue)
text+=child.nodeValue}
return text},setElementText:function(doc,elt,text){XMLUtils.removeAllChildren(elt);elt.appendChild(doc.createTextNode(text))},getChildrenElements:function(node){var children=node.childNodes;var res=[];for(var i=0;i<children.length;++i){if(children[i].nodeType==1)
res[res.length]=children[i]}
return res},setChildText:function(doc,parent,childName,text){var child=XMLUtils.getChildByTagName(childName);if(child==null){child=doc.createElement(childName);parent.appendChild(child)}
XMLUtils.removeAllChildren(child);child.appendChild(doc.createTextNode(text))},getChildText:function(parent,childName){var child=XMLUtils.getChildByTagName(parent,childName);if(!child)return null;return XMLUtils.getElementText(child)},getChildTextSafe:function(parent,childName){var text=XMLUtils.getChildText(parent,childName);return(text==null?"":text)},select:function(context,expr){if(!context)
return null;if((window.XMLHttpRequest&&!window.ActiveXObject)||window.opera){try
{var res=context.ownerDocument.evaluate(expr,context,null,XPathResult.UNORDERED_NODE_ITERATOR_TYPE,null);var node=res.iterateNext();var found=[];while(node){found.push(node);node=res.iterateNext()}
return found}
catch(e){return null}}else
{try
{var res=context.selectNodes(expr);return res}
catch(e){return null}}},selectSingle:function(context,expr){var nodes=XMLUtils.select(context,expr);if(nodes==null||nodes.length<1)
return null;else
return nodes[0]}};JSUtils={NAVIGATOR_UNKNOWN:0,NAVIGATOR_IE:1,NAVIGATOR_SAFARI:2,NAVIGATOR_OPERA:3,NAVIGATOR_MOZILLA:4,NAVIGATOR_CHROME:5,EMPTY_FUNCTION:function(){},TRUE_FUNCTION:function(){return true},FALSE_FUNCTION:function(){return false},IGNORE_EVENT_FUNCTION:function(e){try
{if(typeof("DOMEventUtils")=="undefined")
return false;var ev=DOMEventUtils.getEvent(e);if(ev)
DOMEventUtils.stopPropagation(ev)}
catch(e){}
return false},s_navigator:null,s_navigatorVersion:null,getNavigator:function(){var n=JSUtils.s_navigator;if(n==null){if(window.opera)
n=JSUtils.NAVIGATOR_OPERA;else if(window.navigator&&navigator.vendor&&navigator.vendor.indexOf("Apple")!=-1)
n=JSUtils.NAVIGATOR_SAFARI;else if(window.navigator&&navigator.vendor&&navigator.vendor.indexOf("Google")!=-1)
n=JSUtils.NAVIGATOR_CHROME;else if(window.navigator&&navigator.product=='Gecko')
n=JSUtils.NAVIGATOR_MOZILLA;else if(document.all)
n=JSUtils.NAVIGATOR_IE;else
n=JSUtils.NAVIGATOR_UNKNOWN}
return(JSUtils.s_navigator=n)},getNavigatorVersion:function(){if(JSUtils.s_navigatorVersion==null){var agt=navigator.userAgent.toLowerCase();var major=parseInt(navigator.appVersion);var minor=parseFloat(navigator.appVersion);var v=0;switch(JSUtils.getNavigator()){case JSUtils.NAVIGATOR_IE:if(major<4)
v=3;else if(major==4&&(agt.indexOf("msie 4")!=-1))
v=4;else if(major==4&&(agt.indexOf("msie 5.0")!=-1))
v=5;else if(major==4&&(agt.indexOf("msie 5.5")!=-1))
v=5.5;else if(major==4&&(agt.indexOf("msie 6.")!=-1))
v=6;else
v=7;break;case JSUtils.NAVIGATOR_OPERA:if(agt.indexOf("opera 2")!=-1||agt.indexOf("opera/2")!=-1)
v=2;else if(agt.indexOf("opera 3")!=-1||agt.indexOf("opera/3")!=-1)
v=3;else if(agt.indexOf("opera 4")!=-1||agt.indexOf("opera/4")!=-1)
v=4;else if(agt.indexOf("opera 5")!=-1||agt.indexOf("opera/5")!=-1)
v=5;else
v=6;break}}
return(JSUtils.s_navigatorVersion=v)},isDebug:function(){return(IDM.Debug!==window.undefined)},isObject:function(){return typeof arguments[0]=='object'},isFunction:function(o){return typeof(o)=='function'&&(!Function.prototype.call||typeof(o.call)=='function')},isArray:function(){if(typeof arguments[0]=='array'){return true}else if(typeof arguments[0]=='object'){try
{var criterion=arguments[0].constructor.toString().match(/array/i);return(criterion!=null)}
catch(e){return(arguments[0].length!==window.undefined)}}
return false},isString:function(){return(typeof arguments[0]=='string')},toString:function(x){return""+x},debugObject:function(x){alert(JSUtils.debugObjectStr(x))},debugObjectStr:function(x){var msg="Type: "+JSUtils.getNiceObjectType(x)+"\n\n";for(p in x){if(typeof(x[p])!=='function')
msg+=p+" = "+x[p]+" ("+JSUtils.getNiceObjectType(x[p])+")\n"}
return msg},getNiceObjectType:function(x){var type=typeof(x);if(x===window.undefined){return"undefined"}else if(x===null){return"null"}else if(type=="object"){try
{var ctor=x.constructor.toString();var p=ctor.indexOf("(");if(p!=-1)
ctor=ctor.substring(0,p);if(StringUtils.startsWith(ctor,"function "))
ctor=ctor.substring(9);type+=": "+ctor}
catch(e){}}
return type},getListElementsByClassName:function(className,tag,elm){if(document.getElementsByClassName){getElementsByClassName=function(className,tag,elm){elm=elm||document;var elements=elm.getElementsByClassName(className),nodeName=(tag)?new RegExp("\\b"+tag+"\\b","i"):null,returnElements=[],current;for(var i=0,il=elements.length;i<il;i+=1){current=elements[i];if(!nodeName||nodeName.test(current.nodeName)){returnElements.push(current)}}
return returnElements}}else if(document.evaluate){getElementsByClassName=function(className,tag,elm){tag=tag||"*";elm=elm||document;var classes=className.split(" "),classesToCheck="",xhtmlNamespace="http://www.w3.org/1999/xhtml",namespaceResolver=(document.documentElement.namespaceURI===xhtmlNamespace)?xhtmlNamespace:null,returnElements=[],elements,node;for(var j=0,jl=classes.length;j<jl;j+=1){classesToCheck+="[contains(concat(' ', @class, ' '), ' "+classes[j]+" ')]"}
try
{elements=document.evaluate(".//"+tag+classesToCheck,elm,namespaceResolver,0,null)}
catch(e){elements=document.evaluate(".//"+tag+classesToCheck,elm,null,0,null)}
while((node=elements.iterateNext())){returnElements.push(node)}
return returnElements}}else
{getElementsByClassName=function(className,tag,elm){tag=tag||"*";elm=elm||document;var classes=className.split(" "),classesToCheck=[],elements=(tag==="*"&&elm.all)?elm.all:elm.getElementsByTagName(tag),current,returnElements=[],match;for(var k=0,kl=classes.length;k<kl;k+=1){classesToCheck.push(new RegExp("(^|\\s)"+classes[k]+"(\\s|$)"))}
for(var l=0,ll=elements.length;l<ll;l+=1){current=elements[l];match=false;for(var m=0,ml=classesToCheck.length;m<ml;m+=1){match=classesToCheck[m].test(current.className);if(!match){break}}
if(match){returnElements.push(current)}}
return returnElements}}
return getElementsByClassName(className,tag,elm)},makeCallback:function(target,func){var args=new Array();for(var i=2;i<arguments.length;++i)
args[args.length]=arguments[i];return function(){var actualArgs=new Array();for(var i=0,n=args.length;i<n;++i)
actualArgs[i]=args[i];for(var i=0;i<arguments.length;++i)
actualArgs[actualArgs.length]=arguments[i];return func.apply(target,actualArgs)}},makeCallbackEvent:function(target,func){var args=new Array();for(var i=2;i<arguments.length;++i)
args[args.length]=arguments[i];return function(e){var ev=DOMEventUtils.getEvent(e);var actualArgs=new Array();for(var i=0,n=args.length;i<n;++i)
actualArgs[actualArgs.length]=args[i];actualArgs[actualArgs.length]=ev;for(var i=0;i<arguments.length;++i)
actualArgs[actualArgs.length]=arguments[i];return func.apply(target,actualArgs)}},invokeLater:function(callback,timeout){if(!timeout||timeout<0)
timeout=100;var func=function(){callback()}
setTimeout(func,timeout)},currentTimeMillis:function(){return(new Date()).getTime()},arrayContains:function(arr,what){for(var i=0;i<arr.length;++i)
if(arr[i]==what)return true;return false},arrayInsert:function(arr,what,pos){if(!pos)
pos=arr.length();return arr.splice(pos,0,what)},arrayAdd:function(arr,what){arr.push(what);return arr},arrayRemoveAt:function(arr,pos){arr.splice(pos,1);return arr},arrayRemove:function(arr,what){var res=new Array();for(var i=0;i<arr.length;++i)
if(arr[i]!=what)res.push(arr[i]);return res},arrayMerge:function(arr1,arr2){var res=new Array();var p=0;for(var i=0;i<arr1.length;++i)
res[p++]=arr1[i];for(var i=0;i<arr2.length;++i)
res[p++]=arr2[i];return res},crc32:function(str,crc){var table="00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";if(crc==window.undefined)
crc=0;var n=0;var x=0;crc=crc^(-1);for(var i=0,iTop=str.length;i<iTop;i++){n=(crc^str.charCodeAt(i))&0xFF;x="0x"+table.substr(n*9,8);crc=(crc>>>8)^x}
return crc^(-1)}};CSSUtils={parseColor:function(str){return Color.fromCSS(str)},parseImage:function(str){var re=/^url\(([^\)]+)\)$/;var bits=re.exec(str);if(bits){var tmp=StringUtils.trim(bits[1]);if(tmp.charAt(0)=='"')
tmp=tmp.substring(1);if(tmp.charAt(tmp.length-1)=='"')
tmp=tmp.substring(0,tmp.length-1);return tmp}else
{return""}},selectorMatchesElement:function(elt,selector){var styles=StringUtils.explode('.',selector);var curElt=elt;var curStyle=styles.length-1;var curLevel=0;var maxLevel=5+styles.length;while(curElt!=null&&curStyle>=0&&curLevel<maxLevel){var style=styles[curStyle];if((style[0]=='@'&&(""+curElt.tagName).toLowerCase()==style.substring(1))||(style[0]=='#'&&curElt.id==style.substring(1))||(style=='*')||HTMLUtils.hasStyleClass(curElt,style)){if(curStyle==0)
return true;curStyle--;curElt=curElt.parentNode;curLevel++}else
{if(curLevel==0)
break;curElt=curElt.parentNode;curLevel++}}
return false}};DOMEventUtils={getEvent:function(e){if(window.ActiveXObject)
return window.event;else
return e},getSrcElement:function(e){if(window.ActiveXObject){return e.srcElement}else
{var node=e.srcElement;while(node.nodeType!=node.ELEMENT_NODE)
node=node.parentNode;return node}},getFromElement:function(e){if(window.ActiveXObject)
return e.fromElement;else
{if(e.type=="mouseout")
return e.target;else
return e.relatedTarget}},getToElement:function(e){if(window.ActiveXObject)
return e.toElement;else
{if(e.type=="mouseout")
return e.relatedTarget;else
return e.target}},isShiftPressed:function(e){return(e.shiftKey?true:false)},isCtrlPressed:function(e){return(e.ctrlKey?true:false)},isAltPressed:function(e){return(e.altKey?true:false)},getMousePos:function(e){var x=0;var y=0;if(e.pageX||e.pageY){x=e.pageX;y=e.pageY}else if(window.event&&window.event.clientX){var isStrictMode=document.compatMode&&document.compatMode!='BackCompat'?true:false;var scrollX=isStrictMode?document.documentElement.scrollLeft:document.body.scrollLeft;var scrollY=isStrictMode?document.documentElement.scrollTop:document.body.scrollTop;x=window.event.clientX+scrollX;y=window.event.clientY+scrollY}else if(e.clientX||e.clientY){x=e.clientX+document.body.scrollLeft;y=e.clientY+document.body.scrollTop}
return new Point(x,y)},getRelativeMousePos:function(e,elt){var pos=DOMEventUtils.getMousePos(e);var eltPos=HTMLUtils.getElementPos(elt);pos.x-=eltPos.x;pos.y-=eltPos.y;return pos},getScreenMousePos:function(e){return new Point(e.screenX,e.screenY)},stopPropagation:function(e){try
{if(window.ActiveXObject)
e.cancelBubble=true
else
e.stopPropagation()}
catch(ex){}},VK_BACKSPACE:8,VK_TAB:9,VK_ENTER:10,VK_SHIFT:16,VK_CTRL:17,VK_ALT:18,VK_PAUSE:19,VK_ESCAPE:27,VK_PAGE_UP:33,VK_PAGE_DOWN:34,VK_END:35,VK_HOME:36,VK_LEFT_ARROW:37,VK_UP_ARROW:38,VK_RIGHT_ARROW:39,VK_DOWN_ARROW:40,VK_INSERT:45,VK_DELETE:46,getKeyCode:function(e){var code=0;if(e.which)
code=e.which;else
code=e.keyCode;if(code==10||code==13)
code=DOMEventUtils.VK_ENTER;return code},LEFT_BUTTON:1,RIGHT_BUTTON:2,MIDDLE_BUTTON:3,getButton:function(e){if(window.ActiveXObject){switch(e.button){case 2:return DOMEventUtils.RIGHT_BUTTON;case 4:return DOMEventUtils.MIDDLE_BUTTON;case 1:return DOMEventUtils.LEFT_BUTTON}}else
{switch(e.button){case 2:return DOMEventUtils.RIGHT_BUTTON;case 1:return DOMEventUtils.MIDDLE_BUTTON;case 0:return DOMEventUtils.LEFT_BUTTON}}
return-1},setupDefaultEventCapture:function(obj){obj.__onkeydown=document.onkeydown;document.onkeydown=null;obj.__onkeyup=document.onkeyup;document.onkeyup=null;obj.__onkeypress=document.onkeypress;document.onkeypress=null},resetDefaultEventCapture:function(obj){try{document.onkeydown=obj.__onkeydown}catch(e){}
try{document.onkeyup=obj.__onkeyup}catch(e){}
try{document.onkeypress=obj.__onkeypress}catch(e){}}};MathUtils={normalizeAngle:function(angle){while(angle<0)angle+=360;while(angle>360)angle-=360;return angle},continuedFractions:function(x,order){var epsilon=1e-8;var result=[];for(var i=0;i<order;++i){result[i]=Math.floor(x);var delta=x-result[i];if(Math.abs(delta)<epsilon){while(i<order){result[i]=0.0;i++}
return result}
x=1/delta}
return result},reducedContinuedFraction:function(cf,order){var p=cf[order];var q=1;for(var i=order-1;i>=0;--i){var tmp=p;p=cf[i]*p+q;q=tmp}
return[p,q]}};NumberUtils={formatNumber:function(n,decimals,decPoint,thousandsSep,ignoreTrailingZeroes,avoidDec){if(decimals==window.undefined||decimals==null)
decimals=0;if(decPoint==window.undefined||decPoint==null)
decPoint=',';if(thousandsSep==window.undefined||thousandsSep==null)
thousandsSep='';if(ignoreTrailingZeroes==window.undefined||ignoreTrailingZeroes==null)
ignoreTrailingZeroes=false;if(avoidDec==window.undefined||avoidDec==null)
avoidDec=false;var b=decimals;var c=decPoint;var d=thousandsSep;var p=1;for(var pi=0;pi<b;++pi)
p*=10;var a=Math.round(n*p)/p;var e=a+'';var f=e.split('.');var isInt=(Math.abs(Math.floor(n)-n)<=0.000001);if(!f[0])
f[0]='0';if(!f[1])
f[1]='';if(f[1].length<b){var g=f[1];for(var i=f[1].length+1;i<=b;i++)
g+='0';f[1]=g}
if(d!=''&&f[0].length>3){h=f[0];f[0]='';for(var j=3;j<h.length;j+=3){var i=h.slice(h.length-j,h.length-j+3);f[0]=d+i+f[0]+''}
j=h.substr(0,(h.length%3==0)?3:(h.length%3));f[0]=j+f[0]}
c=(b<=0)?'':c;if(ignoreTrailingZeroes||(avoidDec&&isInt)){while(f[1].length!=0&&f[1].charAt([f[1].length-1])=='0')
f[1]=f[1].substr(0,f[1].length-1);if(f[1].length==0)
c=''}
return f[0]+c+f[1]},formatFloat:function(n,d){if(!d||d<0)d=10;return NumberUtils.formatNumber(n,d,".","",true,false)},formatPercent:function(n,dec){if(!dec)
dec=1;return NumberUtils.formatNumber(n,dec,null,null,true,true)+"\u00A0%"},formatCurrency:function(n,allowFree,digits){if(!digits|| digits<1)
digits=2;if(allowFree===null||allowFree===window.undefined)
allowFree=false;if(allowFree&&Math.abs(n)<=0.001){return"offert"}else
{var res=NumberUtils.formatNumber(n,digits,null,null,false,true);return res+" €"}},randomBigNumber:function(){return""+Math.round(Math.random()*100000000)+Math.round(Math.random()*100000000)},parseNumber:function(str){if(str===null||str===window.undefined)
return null;str=JSUtils.toString(str);var cleanStr="";for(var i=0,n=str.length;i<n;++i){var c=str.charAt(i);if(StringUtils.isDigit(c))
cleanStr+=c;else if(c=='-')
cleanStr+='-';else if(c==','||c=='.')
cleanStr+='.'}
return isNaN(cleanStr)?null:Number(cleanStr)},parseNumberSafe:function(str,defaultValue){var n=NumberUtils.parseNumber(str);return(n==null?(defaultValue?defaultValue:0):n)}};StringUtils={formatByteSize:function(n){n=Math.round(n);if(n>=1024*1024*1024)
return NumberUtils.formatNumber(n/(1024.*1024.*1024.),1)+' Go';else if(n>=1024*1024)
return NumberUtils.formatNumber(n/(1024.*1024.),1)+' Mo';else if(n>=1024)
return NumberUtils.formatNumber(n/1024.,1)+' Ko';else
return n+' octet(s)'},formatDuration:function(n){n=Math.round(n);var hours=Math.floor(n/3600);var mins=Math.floor((n%3600)/60);var secs=Math.floor((n%3600)%60);var res=[];if(hours>1)
res[res.length]=hours+" heures";else if(hours==1)
res[res.length]="1 heure";if(mins>1)
res[res.length]=mins+" min";else if(mins==1)
res[res.length]="1 min";if(secs>1)
res[res.length]=secs+" sec";else if(secs==1)
res[res.length]="1 sec";return(res.length==0?"-":StringUtils.implode(" ",res))},formatString:function(str){for(var i=1;i<arguments.length;++i)
str=StringUtils.replaceString(str,"%"+i,JSUtils.toString(arguments[i]));return str},padLeft:function(str,len,paddingChar){str=""+str;if(str.length>=len)
return str;for(var r=len-str.length;r>0;r--)
str=paddingChar+str;return str},escapeXML:function(str){str=StringUtils.replaceString(str,"&","&amp;");str=StringUtils.replaceString(str,"<","&lt;");str=StringUtils.replaceString(str,">","&gt;");str=StringUtils.replaceString(str,'"',"&quot;");return str},startsWith:function(str,startStr){return str.substring(0,startStr.length)==startStr},replaceStringRegExp:function(str,find,replaceWith){if(JSUtils.isString(find))
find=new RegExp(find,"g");str=new String(str);return str.replace(find,replaceWith)},replaceString:function(str,find,replaceWith){find=new String(find);str=new String(str);var pos=-replaceWith.length;while((pos=str.indexOf(find,pos+replaceWith.length))!=-1)
str=str.substring(0,pos)+replaceWith+str.substring(pos+find.length);return JSUtils.toString(str)},trim:function(str){if(str===window.undefined||str===null)
return"";str=str.replace(/^\s+/g,"");return str.replace(/\s+$/g,"")},ltrim:function(str){if(str===undefined||str===null)
return"";var regExpBeginning=/^\s+/;return str.replace(regExpBeginning,"")},rtrim:function(str){if(str===undefined||str===null)
return"";var regExpEnd=/\s+$/;return str.replace(regExpEnd,"")},removeNewLines:function(str){str=StringUtils.replaceString(str,"\r","\n");str=StringUtils.replaceString(str,"\n\n","\n");str=StringUtils.replaceString(str,"\n"," ");return str},encodeUTF8:function(rohtext){rohtext=rohtext.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<rohtext.length;n++){var c=rohtext.charCodeAt(n);if(c<128)
utftext+=String.fromCharCode(c);else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128)}else
{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128)}}
return utftext},encodeBase64:function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";if(input.length==0)
return"";do{chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2))
enc3=enc4=64;else if(isNaN(chr3))
enc4=64;output=output+keyStr.charAt(enc1)+keyStr.charAt(enc2)+
keyStr.charAt(enc3)+keyStr.charAt(enc4)}while(i<input.length);return output},decodeBase64:function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";if(input.length==0)
return"";input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64)
output=output+String.fromCharCode(chr2);if(enc4!=64)
output=output+String.fromCharCode(chr3)}while(i<input.length);return output},generateRandomString:function(length,alphabet){if(length==window.undefined)
length=10;if(alphabet==window.undefined||alphabet.length<1)
alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";var res="";for(var i=0;i<length;++i)
res+=alphabet.charAt(Math.round(Math.random()*(alphabet.length-1)));return res},joinMap:function(map,valueSep,entrySep){var res="";for(key in map){if(res!="")
res+=entrySep;res+=key+valueSep+map[key]}
return res},isDigit:function(ch){return("0123456789".indexOf(ch)!=-1)},noBreakSpace:function(str){return StringUtils.replaceString(str," ","\u00A0")},contains:function(str,what){return(""+str).indexOf(what)!=-1},explode:function(separators,inputString,includeEmpties){inputString=new String(inputString);separators=new String(separators);if(!separators)
separators=" :;";var fixedExplode=new Array(1);var currentElement="";var count=0;for(var x=0;x<inputString.length;++x){var chr=inputString.charAt(x);if(separators.indexOf(chr)!=-1){fixedExplode[count]=currentElement;count++;currentElement=""}else
{currentElement+=chr}}
fixedExplode[count]=currentElement;if(!includeEmpties){var tmp=new Array();for(var i=0;i<fixedExplode.length;++i){if((""+fixedExplode[i]).length!=0)
tmp[tmp.length]=fixedExplode[i]}
fixedExplode=tmp}
return fixedExplode},implode:function(sep,arr){var res="";for(var i=0;i<arr.length;++i)
res+=(i==0?"":sep)+""+arr[i];return res}};Point=Class.define
({ctor:function(x,y){if(arguments.length==2){if(isNaN(x))x=0;if(isNaN(y))y=0;this.x=x;this.y=y}else
{this.x=0;this.y=0}},static:{createFromXML:function(node){node=XMLUtils.getChildByTagName(node,"point");return new Point(Number(node.getAttribute("x"))/1000,Number(node.getAttribute("y"))/1000)}},prototype:{offset:function(x,y){var p=this.clone();if(arguments.length==1){p.x+=x.x;p.y+=x.y}else
{p.x+=x;p.y+=y}
return p},clone:function(){return new Point(this.x,this.y)},writeToXML:function(doc){var node=doc.createElement("point");node.setAttribute("x",NumberUtils.formatFloat(this.x*1000.0,10));node.setAttribute("y",NumberUtils.formatFloat(this.y*1000.0,10));return node},rotate:function(angle,center){var rad=-(angle*Math.PI)/180;if(!center)
center=new Point(0,0);var x=this.x-center.x;var y=this.y-center.y;var s=Math.sin(rad);var c=Math.cos(rad);var rx=x*c-y*s;var ry=y*c+x*s;return new Point(rx+center.x,ry+center.y)},translate:function(vector){return new Point(this.x+vector.x,this.y+vector.y)}}});Vector=Class.define
({ctor:function(x,y){if(typeof(x)=="object"&&typeof(y)=="object"){Vector.baseConstructor.call(this);this.x=y.x-x.x;this.y=y.y-x.y}else
{Vector.baseConstructor.call(this,x,y)}},inherits:Point,prototype:{normalize:function(){var l=this.getLength();if(l!=0)
return this.grow(1.0/l);else
return this.clone()},grow:function(factor){var v=this.clone();v.x*=factor;v.y*=factor;return v},getLength:function(){return Math.sqrt(this.x*this.x+this.y*this.y)}}});Size=Class.define
({ctor:function(w,h){if(arguments.length==2){if(isNaN(w))w=0;if(isNaN(h))h=0;this.width=w;this.height=h}else
{this.width=0;this.height=0}},prototype:{grow:function(x,y){var s=this.clone();if(arguments.length==1){if(typeof(x)==="object"){if(x.width!=window.undefined){s.width+=x.width;s.height+=x.height}else
{s.width+=x.x;s.height+=x.y}}else
{s.width*=x;s.height*=x}}else
{s.width+=x;s.height+=y}
return s},clone:function(){return new Size(this.width,this.height)}}});Rect=Class.define
({ctor:function(x1,y1,x2,y2){if(arguments.length==2){this.x1=x1.x;this.y1=x1.y;if(y1 instanceof Size){this.x2=this.x1+y1.width;this.y2=this.y1+y1.height}else
{this.x2=y1.x;this.y2=y1.y}}else if(arguments.length==4){if(isNaN(x1))x1=0;if(isNaN(y1))y1=0;if(isNaN(x2))x2=0;if(isNaN(y2))y2=0;this.x1=x1;this.y1=y1;this.x2=x2;this.y2=y2}else
{this.x1=0;this.y1=0;this.x2=0;this.y2=0}},static:{createFromXML:function(node,tagName){node=XMLUtils.getChildByTagName(node,tagName===window.undefined?"rect":tagName);if(!node)
return null;return new Rect(NumberUtils.parseNumberSafe(node.getAttribute("x1"))/1000.0,NumberUtils.parseNumberSafe(node.getAttribute("y1"))/1000.0,NumberUtils.parseNumberSafe(node.getAttribute("x2"))/1000.0,NumberUtils.parseNumberSafe(node.getAttribute("y2"))/1000.0)}},prototype:{getSize:function(){return new Size(Math.abs(this.x2-this.x1),Math.abs(this.y2-this.y1))},getWidth:function(){return Math.abs(this.x2-this.x1)},getHeight:function(){return Math.abs(this.y2-this.y1)},getOrigin:function(){return new Point(this.x1,this.y1)},getEnd:function(){return new Point(this.x2,this.y2)},getCenter:function(){return new Point((this.x1+this.x2)/2,(this.y1+this.y2)/2)},resize:function(x,y){var sx,sy;if(arguments.length==1){if(x.width!=window.undefined){sx=x.width;sy=x.height}else
{sx=x.x;sy=x.y}}else
{sx=x;sy=y}
return new Rect(this.x1,this.y1,this.x1+sx,this.y1+sy)},normalize:function(){var r=this.clone();if(this.x1>this.x2){r.x1=this.x2;r.x2=this.x1}
if(this.y1>this.y2){r.y1=this.y2;r.y2=this.y1}
return r},grow:function(x,y){return this.resize(this.getSize().grow(x,y))},inflate:function(n){var r=this.clone();r.x1-=n;r.y1-=n;r.x2+=n;r.y2+=n;return r},deflate:function(n){return this.inflate(-n)},move:function(x,y){if(arguments.length==1)
return new Rect(x.x,x.y,x.x+this.x2-this.x1,x.y+this.y2-this.y1);else
return new Rect(x,y,x+this.x2-this.x1,y+this.y2-this.y1)},centerIn:function(other){var dx=(other.x2-other.x1)-(this.x2-this.x1);var dy=(other.y2-other.y1)-(this.y2-this.y1);return this.move(other.x1+dx/2,other.y1+dy/2)},offset:function(x,y){var r=this.clone();if(arguments.length==1){r.x1+=x.x;r.y1+=x.y;r.x2+=x.x;r.y2+=x.y}else
{r.x1+=x;r.y1+=y;r.x2+=x;r.y2+=y}
return r},clone:function(){return new Rect(this.x1,this.y1,this.x2,this.y2)},writeToXML:function(doc,tagName){var node=doc.createElement(tagName===window.undefined?"rect":tagName);node.setAttribute("x1",NumberUtils.formatFloat(this.x1*1000.0,10));node.setAttribute("y1",NumberUtils.formatFloat(this.y1*1000.0,10));node.setAttribute("x2",NumberUtils.formatFloat(this.x2*1000.0,10));node.setAttribute("y2",NumberUtils.formatFloat(this.y2*1000.0,10));return node},rotate:function(angle){var p1=new Point(this.x1,this.y1);var p2=new Point(this.x2,this.y1);var p3=new Point(this.x2,this.y2);var p4=new Point(this.x1,this.y2);var p0=new Point((p1.x+p3.x)/2,(p1.y+p3.y)/2);var p=new Polygon();p.addPoint(p1.rotate(angle,p0));p.addPoint(p2.rotate(angle,p0));p.addPoint(p3.rotate(angle,p0));p.addPoint(p4.rotate(angle,p0));return p},union:function(other){var minX=Math.min(this.x1,Math.min(other.x1,Math.min(this.x2,other.x2)));var minY=Math.min(this.y1,Math.min(other.y1,Math.min(this.y2,other.y2)));var maxX=Math.max(this.x1,Math.max(other.x1,Math.max(this.x2,other.x2)));var maxY=Math.max(this.y1,Math.max(other.y1,Math.max(this.y2,other.y2)));return new Rect(minX,minY,maxX,maxY)},contains:function(other){return(this.x1<=other.x1&&this.y1<=other.y1&&this.x2>=other.x2&&this.y2>=other.y2)},intersects:function(other){var x1=Math.min(this.x1,this.x2);var y1=Math.min(this.y1,this.y2);var x2=Math.max(this.x1,this.x2);var y2=Math.max(this.y1,this.y2);var ox1=Math.min(other.x1,other.x2);var oy1=Math.min(other.y1,other.y2);var ox2=Math.max(other.x1,other.x2);var oy2=Math.max(other.y1,other.y2);return(ox1<x2&&ox2>x1&&oy1<y2&&oy2>y1)},clipIn:function(bounds,force){var boundsSize=bounds.getSize();var size=this.getSize();var e=3;if(!force&&(size.width>boundsSize.width+e||size.height>boundsSize.height+e))
return this.clone();var r=this.clone();if(this.x2>bounds.x2){var d=this.x2-bounds.x2;r.x1-=d;r.x2-=d}
if(this.y2>bounds.y2){var d=this.y2-bounds.y2;r.y1-=d;r.y2-=d}
if(this.x1<bounds.x1){var d=bounds.x1-this.x1;r.x1+=d;r.x2+=d}
if(this.y1<bounds.y1){var d=bounds.y1-this.y1;r.y1+=d;r.y2+=d}
return r},shrinkIn:function(bounds){var r=this.clone();if(r.x1<bounds.x1)r.x1=bounds.x1;if(r.y1<bounds.y1)r.y1=bounds.y1;if(r.x1>bounds.x2)r.x1=bounds.x2;if(r.y1>bounds.y2)r.y1=bounds.y2;if(r.x2<bounds.x1)r.x2=bounds.x1;if(r.y2<bounds.y1)r.y2=bounds.y1;if(r.x2>bounds.x2)r.x2=bounds.x2;if(r.y2>bounds.y2)r.y2=bounds.y2;return r},fitRatio:function(bounds){var res=this.clone();var maxWidth=bounds.x2-bounds.x1;var maxHeight=bounds.y2-bounds.y1;var width=this.x2-this.x1;var height=this.y2-this.y1;var r=Math.min(maxWidth/width,maxHeight/height);res.x2=res.x1+width*r;res.y2=res.y1+height*r;return res},toString:function(){return"[ "+this.x1+", "+this.y1+", "+this.x2+", "+this.y2+" ]"}}});Polygon=Class.define
({ctor:function(){this.m_points=new ArrayList()},prototype:{getBoundingRect:function(){if(this.m_points.getCount()==0)
return new Rect();var minX=this.m_points.getAt(0).x;var minY=this.m_points.getAt(0).y;var maxX=minX;var maxY=minY;var n=this.m_points.getCount();for(var i=1;i<n;++i){var p=this.m_points.getAt(i);minX=Math.min(minX,p.x);minY=Math.min(minY,p.y);maxX=Math.max(maxX,p.x);maxY=Math.max(maxY,p.y)}
return new Rect(minX,minY,maxX,maxY)},addPoint:function(pt){this.m_points.add(pt)},getPoints:function(){return this.m_points},getCenter:function(){return this.getBoundingRect().getCenter()},pointIn:function(pt){var counter=0;var p1=this.m_points.getAt(0);var n=this.m_points.getCount();for(var i=1;i<=n;++i){var p2=this.m_points.getAt(i%n);if(pt.y>Math.min(p1.y,p2.y)&&pt.y<=Math.max(p1.y,p2.y)&&pt.x<=Math.max(p1.x,p2.x)&&p1.y!=p2.y){var xinters=(pt.y-p1.y)*(p2.x-p1.x)/(p2.y-p1.y)+p1.x;if(p1.x==p2.x||pt.x<=xinters)
++counter}
p1=p2}
return((counter%2)!=0)},offset:function(x,y){var p=new Polygon();var n=this.m_points.getCount();for(var i=0;i<n;++i)
p.m_points.add(this.m_points.getAt(i).offset(x,y));return p},clone:function(){var p=new Polygon();var n=this.m_points.getCount();for(var i=0;i<n;++i)
p.m_points.add(this.m_points.getAt(i).clone());return p},getXs:function(){var res=new Array();var n=this.m_points.getCount();for(var i=0;i<n;++i)
res[res.length]=this.m_points.getAt(i).x;return res},getYs:function(){var res=new Array();var n=this.m_points.getCount();for(var i=0;i<n;++i)
res[res.length]=this.m_points.getAt(i).y;return res},rotate:function(angle){var center=this.getCenter();var n=this.m_points.getCount();var res=new Polygon();for(var i=0;i<n;++i)
res.m_points.add(this.m_points.getAt(i).rotate(angle,center));return res}}});IDM.Cookie=Class.define
({ctor:function(name){this.m_name=StringUtils.trim(name)},static:{s_cookies:[],get:function(name){if(IDM.Cookie.s_cookies[name]!==window.undefined)
return IDM.Cookie.s_cookies[name];var cookie=new Cookie(name);IDM.Cookie.s_cookies[name]=cookie;return cookie},createCookieImpl:function(name,value,days){var expires="";if(days!=0){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toGMTString()}
document.cookie=URL.escape(name)+"="+URL.escape(value)+expires+"; path=/"}},prototype:{getValue:function(){var nameEQ=URL.escape(this.m_name);var ca=document.cookie.split(';');for(var i=0;i<ca.length;++i){var c=ca[i];var nameValue=c.split("=");var cookieName=URL.escape(StringUtils.trim(nameValue[0]));var cookieValue=URL.unescape(StringUtils.trim(nameValue[1]));if(nameEQ==cookieName){return cookieValue}}
return null},setValue:function(value,days){IDM.Cookie.createCookieImpl(this.m_name,value,days)},erase:function(){IDM.Cookie.createCookieImpl(this.m_name,"",-1)}}});IDM.AsynchronousLoader=Class.define
({ctor:function(){this.m_started=false;this.m_loaded=false;this.m_callbacks=new ArrayList()},prototype:{fireLoaded:function(){this.m_loaded=true;var callbacks=this.m_callbacks.clone();this.m_callbacks.removeAll();for(var i=0,n=callbacks.getCount();i<n;++i){var callback=callbacks.getAt(i);callback()}},isLoaded:function(){return this.m_loaded},callWhenLoaded:function(callback){if(this.isLoaded()){callback()}else
{this.m_callbacks.add(callback);if(!this.m_started){this.m_started=true;JSUtils.invokeLater(JSUtils.makeCallback(this,IDM.AsynchronousLoader.prototype._loadTimeout))}}},_loadTimeout:function(){this.load()},load:function(){}}});IDM.Window=Class.define
({ctor:function(){IDM.Window.baseConstructor.call(this);this.m_contElt=null;this.m_frameElt=null;this.m_modal=true;this.m_preview=false;this.m_eventLayer=null;this.m_shadow=null;this.m_visible=false;this.timer=null;this.declareSlot("show")},inherits:IDM.Object,static:{s_centeringOffset:[0,0,0,0],setCenteringOffset:function(l,t,r,b){IDM.Window.s_centeringOffset=[l,t,r,b]},setCenteringOffsetLeft:function(n){IDM.Window.s_centeringOffset[0]=n},setCenteringOffsetTop:function(n){IDM.Window.s_centeringOffset[1]=n},setCenteringOffsetRight:function(n){IDM.Window.s_centeringOffset[2]=n},setCenteringOffsetBottom:function(n){IDM.Window.s_centeringOffset[3]=n},_showSelects:function(frame,show){if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_IE&&JSUtils.getNavigatorVersion()<=6){var elts=document.getElementsByTagName("select");for(var i=0;i<elts.length;++i){var elt=elts[i];if(HTMLUtils.hasParent(elt,frame))
continue;if(!elt.m_visibleCounter)
elt.m_visibleCounter=(elt.style.visibility=="hidden"?-1:0);if(show){if(++elt.m_visibleCounter>=0)
elt.style.visibility=""}else
{elt.m_visibleCounter--;elt.style.visibility="hidden"}}}}},prototype:{setModal:function(modal){this.m_modal=(modal?true:false)},getHTMLElement:function(){return this.m_contElt.getElement()},setPreview:function(preview){this.m_preview=(preview?true:false)},move:function(x,y){var newPosX=this.getHTMLElement().offsetLeft+x;var newPosY=this.getHTMLElement().offsetTop+y;this.m_shadow.remove();this.getHTMLElement().style.left=newPosX+"px";this.getHTMLElement().style.top=newPosY+"px";this.m_shadow.apply()},isVisible:function(){return this.m_visible},_construct:function(contElt,boxElt){},_constructImpl:function(){if(this.m_contElt!=null)
this._destroy();var contElt=document.createElement("div");contElt.className="idm-window";var boxElt=null;if(window.ActiveXObject){var table=document.createElement("table");table.cellSpacing="0";table.cellPadding="0";table.border="0";table.style.margin="0px";var row=table.insertRow(0);boxElt=row.insertCell(0);boxElt.className="idm-window-container";contElt.appendChild(table)}else
{boxElt=document.createElement("div");boxElt.className="idm-window-container";contElt.appendChild(boxElt)}
for(var i=1;i<=3;++i){var customDivElt=document.createElement("div");customDivElt.className="idm-window-custom-div"+i;boxElt.appendChild(customDivElt);var cdInnerElt=document.createElement("div");cdInnerElt.className="idm-window-custom-div"+i+"-inner";customDivElt.appendChild(cdInnerElt)}
var eventLayer=HTMLUtils.createEventLayer();eventLayer.style.display="none";if(!this.m_preview)
eventLayer.className="idm-window-event-layer";this.m_eventLayer=NodeRef.create(eventLayer);contElt.style.position="absolute";contElt.style.left="-10000px";contElt.style.top="-10000px";if(this.m_modal&&false){var frameElt=document.createElement("iframe");frameElt.style.position="absolute";frameElt.style.border="0px solid black";frameElt.frameBorder="0";frameElt.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';frameElt.src='javascript:function f() { }';HTMLUtils.setElementPos(frameElt,new Point(-10,-10));HTMLUtils.setElementSize(frameElt,HTMLUtils.getDocumentSize());document.body.appendChild(frameElt);this.m_frameElt=NodeRef.create(frameElt)}
document.body.appendChild(eventLayer);document.body.appendChild(contElt);this.m_contElt=NodeRef.create(contElt);this._construct(contElt,boxElt)},show:function(){this.m_visible=true;HTMLUtils.killFocus();this._constructImpl();var contElt=this.m_contElt.getElement();contElt.style.position="absolute";contElt.style.width="";contElt.style.height="";contElt.onkeypress=JSUtils.makeCallbackEvent(this,IDM.Window.prototype._IDMWindow_onKeyPress);var bodySize=HTMLUtils.getWindowInnerSize();var bodyPos=HTMLUtils.getScrollPos();bodyPos.x+=IDM.Window.s_centeringOffset[0];bodyPos.y+=IDM.Window.s_centeringOffset[1];bodySize.width-=IDM.Window.s_centeringOffset[0]+IDM.Window.s_centeringOffset[2];bodySize.height-=IDM.Window.s_centeringOffset[1]+IDM.Window.s_centeringOffset[3];var contSize=HTMLUtils.getElementSize(contElt);var maxWidth=this._getMaximumWidth(bodySize);if(maxWidth!=0&&contSize.width>maxWidth){contElt.style.width=maxWidth+"px";contElt.style.height="";contSize=HTMLUtils.getElementSize(contElt)}
var contPos=new Point();contPos.x=bodyPos.x+(bodySize.width-contSize.width)/2;contPos.y=bodyPos.y+(bodySize.height-contSize.height)/2;contElt.style.position="absolute";contElt.style.left=Math.floor(contPos.x)+"px";contElt.style.top=Math.floor(contPos.y)+"px";if(this.m_modal){IDM.Window._showSelects(contElt,false);this.m_eventLayer.getElement().style.display=""}
this.m_shadow=new IDM.Effect.Shadow.Full(contElt);this.m_shadow.apply();JSUtils.invokeLater(JSUtils.makeCallback(this,IDM.Window.prototype._onShowImpl));if(this.m_modal)
DOMEventUtils.setupDefaultEventCapture(this)},_onShowImpl:function(){this.getNamedSlot("show").trigger();this._onShow()},_getMaximumWidth:function(bodySize){return 0},close:function(){if(this.m_modal){DOMEventUtils.resetDefaultEventCapture(this);if(this.m_contElt!=null)
IDM.Window._showSelects(this.m_contElt.getElement(),true)}
this._destroy()},_destroy:function(){if(this.m_shadow!=null){this.m_shadow.destroy();this.m_shadow=null}
if(this.m_eventLayer!=null){var eventLayer=this.m_eventLayer.getElement();eventLayer.parentNode.removeChild(eventLayer);this.m_eventLayer=null}
if(this.m_contElt!=null){var contElt=this.m_contElt.getElement();contElt.parentNode.removeChild(contElt);this.m_contElt=null}
if(this.m_frameElt!=null){var frameElt=this.m_frameElt.getElement();frameElt.parentNode.removeChild(frameElt);this.m_frameElt=null}
this.m_visible=false},_IDMWindow_onKeyPress:function(e){var ev=DOMEventUtils.getEvent(e);if(DOMEventUtils.getKeyCode(ev)==DOMEventUtils.VK_ESCAPE)
this._onPressedEscapeKey();else if(DOMEventUtils.getKeyCode(ev)==13||DOMEventUtils.getKeyCode(ev)==10)
this._onPressedEnterKey()},_getEventLayerElt:function(){return this.m_eventLayer.getElement()},_onPressedEnterKey:function(){},_onPressedEscapeKey:function(){this.close()},_onShow:function(){}}});IDM.Dialog=Class.define
({ctor:function(){IDM.Dialog.baseConstructor.call(this);this.m_title="";this.m_buttons=[IDM.Dialog.Button.OK];this.m_result=null;this.m_intro=null;this.m_onClickedButtonCallback=null;this.m_move=false;this.declareSlot("button-clicked");this.buttonsElements=new Array()},inherits:IDM.Window,prototype:{enableButton:function(btn){var el=JSUtils.isObject(btn)?document.getElementById(this.buttonsElements[""+btn.getId()+""]):document.getElementById(this.buttonsElements[btn]);HTMLUtils.setElementEnabled(el.id)},disableButton:function(btn){var el=JSUtils.isObject(btn)?document.getElementById(this.buttonsElements[""+btn.getId()+""]):document.getElementById(this.buttonsElements[btn]);HTMLUtils.setElementDisabled(el.id)},getButtonHTMLElementID:function(btnID){return this.buttonsElements[btnID]},setIntroText:function(text){this.m_intro=StringUtils.replaceString(StringUtils.escapeXML(text),"\n","<br/>")},setIntroHTMLText:function(text){this.m_intro=text},setButtons:function(buttons){this.m_buttons=buttons},setTitle:function(title){this.m_title=title},setOnClickedButtonCallback:function(fct){this.m_onClickedButtonCallback=fct},getResult:function(){return this.m_result},_onClickedButtonImpl:function(btn){var result=this._buildResult(btn);this.m_result=result;var close=this._onClickedButton(btn);if(close&&this.m_onClickedButtonCallback)
close=close&&this.m_onClickedButtonCallback(this,result);if(close){var res=this.getNamedSlot("button-clicked").trigger(result);if(res!==window.undefined)
close=res}
if(close)
this.close()},_onClickedButton:function(btn){return true},_clickButton:function(btn){this._onClickedButtonImpl(btn)},_destroy:function(){IDM.Window.prototype._destroy.call(this)},_buildResult:function(btn){return new IDM.Dialog.Result(btn)},_construct:function(contElt,boxElt){contElt.className+=" idm-dialog";if(this.m_title!=null&&JSUtils.toString(this.m_title).length!=0){var titleElt=document.createElement("div");titleElt.appendChild(document.createTextNode(JSUtils.toString(this.m_title)));titleElt.className="title";titleElt.style.cursor="move";boxElt.appendChild(titleElt);titleElt.onmousedown=JSUtils.makeCallback(this,IDM.Dialog.prototype._onMouseDownTitle);titleElt.onmousemove=JSUtils.makeCallback(this,IDM.Dialog.prototype._onMouseMoveTitle);titleElt.onmouseup=JSUtils.makeCallback(this,IDM.Dialog.prototype._onMouseUpTitle)}
for(var i=1;i<=3;++i){var customDivElt=document.createElement("div");customDivElt.className="idm-dialog-custom-div"+i;boxElt.appendChild(customDivElt)}
var dialogCtsElt=document.createElement("div");dialogCtsElt.className="contents";boxElt.appendChild(dialogCtsElt);this._constructInner(contElt,dialogCtsElt);for(var i=4;i<=6;++i){var customDivElt=document.createElement("div");customDivElt.className="idm-dialog-custom-div"+i;boxElt.appendChild(customDivElt)}
if(this.m_intro!=null){var textTag="p";if(StringUtils.contains(this.m_intro,"<div")||StringUtils.contains(this.m_intro,"<p"))
textTag="div";var textElt=document.createElement(textTag);textElt.innerHTML=this.m_intro;textElt.className="intro";if(dialogCtsElt.firstChild)
dialogCtsElt.insertBefore(textElt,dialogCtsElt.firstChild);else
dialogCtsElt.appendChild(textElt)}
var buttons=this.m_buttons;var buttonsElt=document.createElement("div");buttonsElt.className="buttons";if(buttons!=null&&buttons.length!=0){for(var i=0,n=buttons.length;i<n;++i){var btn=buttons[i];if(i!=0){var spaceElt=document.createElement("span");spaceElt.innerHTML="&#160;&#160";buttonsElt.appendChild(spaceElt)}
if(btn.getId()==-10000){var spaceElt=document.createElement("span");spaceElt.innerHTML="&#160;&#160&#160;&#160;&#160;";buttonsElt.appendChild(spaceElt);continue}
var btnElt=document.createElement("button");btnElt.className="button button-control";btnElt.id=HTMLUtils.generateUniqueId();this.buttonsElements[btn.getId()]=btnElt.id;btnElt.appendChild(document.createTextNode(btn.getText()));btnElt.onclick=JSUtils.makeCallback(this,IDM.Dialog.prototype._onClickedButtonImpl,btn);buttonsElt.appendChild(btnElt)}}else
{buttonsElt.style.fontSize="1px";var img=document.createElement("img");img.src="/styles/image.php?path=page/spacer.png";img.width=1;img.height=1;buttonsElt.appendChild(img)}
boxElt.appendChild(buttonsElt);HTMLUtils.initGetFocus()},_constructInner:function(contElt,boxElt){},_onMouseDownTitle:function(e){var ev=DOMEventUtils.getEvent(e);DOMEventUtils.stopPropagation(ev);if(this.m_move)
return false;var contElt=this.m_contElt.getElement();HTMLUtils.setElementOpacity(contElt,70);this.m_move=true;this.m_moveStartPoint=DOMEventUtils.getMousePos(ev);this.m_moveInitialPos=HTMLUtils.getElementPos(contElt);this.m_moveDocMM=document.onmousemove;document.onmousemove=JSUtils.makeCallback(this,IDM.Dialog.prototype._onMouseMoveTitle);this.m_moveDocMU=document.onmouseup;document.onmouseup=JSUtils.makeCallback(this,IDM.Dialog.prototype._onMouseUpTitle);var layerElt=this._getEventLayerElt();this.m_moveLayerMM=layerElt.onmousemove;layerElt.onmousemove=JSUtils.makeCallback(this,IDM.Dialog.prototype._onMouseMoveTitle);this.m_moveLayerMU=layerElt.onmouseup;layerElt.onmouseup=JSUtils.makeCallback(this,IDM.Dialog.prototype._onMouseUpTitle);if(this.m_shadow)
this.m_shadow.remove();return false},_onMouseMoveTitle:function(e){var ev=DOMEventUtils.getEvent(e);DOMEventUtils.stopPropagation(ev);if(!this.m_move)
return false;var pt=DOMEventUtils.getMousePos(ev);var contElt=this.m_contElt.getElement();HTMLUtils.setElementPos(contElt,this.m_moveInitialPos.offset(pt.x-this.m_moveStartPoint.x,pt.y-this.m_moveStartPoint.y));return false},_onMouseUpTitle:function(e){var ev=DOMEventUtils.getEvent(e);DOMEventUtils.stopPropagation(ev);if(!this.m_move)
return false;var contElt=this.m_contElt.getElement();HTMLUtils.setElementOpacity(contElt,100);if(this.m_shadow)
this.m_shadow.apply();this.m_move=false;document.onmousemove=this.m_moveDocMM;this.m_moveDocMM=null;document.onmouseup=this.m_moveDocMU;this.m_moveDocMU=null;var layerElt=this._getEventLayerElt();layerElt.onmousemove=this.m_moveLayerMM;this.m_moveLayerMM=null;layerElt.onmouseup=this.m_moveLayerMU;this.m_moveLayerMU=null;return false},_getDefaultButton:function(){var buttons=this.m_buttons;var defBtn=null;for(var i=0,n=buttons.length;i<n;++i){var btn=buttons[i];if(btn.isDefaultButton()||n==1){if(btn.isCustomButton())
return btn;defBtn=btn}}
return defBtn},_onPressedEscapeKey:function(){var buttons=this.m_buttons;for(var i=0,n=buttons.length;i<n;++i){var btn=buttons[i];if(btn.isCancelButton()){this._onClickedButtonImpl(btn);return}}},_onPressedEnterKey:function(){var focusElt=HTMLUtils.getFocus();if(focusElt!=null&&focusElt.tagName.toLowerCase()=="textarea")
return;HTMLUtils.killFocus();var btn=this._getDefaultButton();if(btn!=null){this._onClickedButtonImpl(btn);return}}}});IDM.Dialog.Button=Class.define
({ctor:function(text,id,flags){this.m_text=text;this.m_id=id;this.m_flags=(flags==window.undefined?0:flags)},static:{FLAG_CANCEL:0x1,FLAG_DEFAULT:0x2},prototype:{getText:function(){return this.m_text},getId:function(){return this.m_id},isCustomButton:function(){return this.m_id>0},isDefaultButton:function(){return(this.m_flags&IDM.Dialog.Button.FLAG_DEFAULT)!=0},isCancelButton:function(){return(this.m_flags&IDM.Dialog.Button.FLAG_CANCEL)!=0}}});IDM.Dialog.ButtonSeparator=Class.define
({ctor:function(){},inherits:IDM.Dialog.Button,prototype:{getText:function(){return null},getId:function(){return-10000}}});IDM.Dialog.Button.OK=new IDM.Dialog.Button("OK",-1,IDM.Dialog.Button.FLAG_DEFAULT);IDM.Dialog.Button.YES=new IDM.Dialog.Button("Oui",-2,IDM.Dialog.Button.FLAG_DEFAULT);IDM.Dialog.Button.NO=new IDM.Dialog.Button("Non",-3,IDM.Dialog.Button.FLAG_CANCEL);IDM.Dialog.Button.CANCEL=new IDM.Dialog.Button("Annuler",-4,IDM.Dialog.Button.FLAG_CANCEL);IDM.Dialog.Button.CLOSE=new IDM.Dialog.Button("Fermer",-5,IDM.Dialog.Button.FLAG_CANCEL|IDM.Dialog.Button.FLAG_DEFAULT);IDM.Dialog.Button.HELP=new IDM.Dialog.Button("Aide",-6);IDM.Dialog.Button.SEPARATOR=new IDM.Dialog.ButtonSeparator();IDM.Dialog.Result=Class.define
({ctor:function(btn){this.m_btn=btn},prototype:{getButton:function(){return this.m_btn}}});IDM.MessageBox=Class.define
({ctor:function(){IDM.MessageBox.baseConstructor.call(this);this.m_text="";this.m_promptText=null;this.m_promptValue="";this.m_checkText=null;this.m_checkValue=false;this.m_appendHTML="";this.m_promptValueElt=null;this.m_checkValueElt=null},inherits:IDM.Dialog,static:{Button:IDM.Dialog.Button},prototype:{setText:function(text){this.m_text=StringUtils.replaceString(StringUtils.escapeXML(text),"\n","<br/>")},setHTMLText:function(text){this.m_text=text},setPrompt:function(text,value){if(value===null||value===window.undefined)
value="";this.m_promptText=text;this.m_promptValue=value},setCheck:function(text,value){this.m_checkText=text;this.m_checkValue=(value?true:false)},setAppendHTML:function(text){this.m_appendHTML=text},_constructInner:function(contElt,boxElt){contElt.className+=" idm-message-box";var textTag="p";if(StringUtils.contains(this.m_text,"<div")||StringUtils.contains(this.m_text,"<p"))
textTag="div";var textElt=document.createElement(textTag);textElt.innerHTML=this.m_text;textElt.className="text";boxElt.appendChild(textElt);if(this.m_promptText!==null){var promptElt=document.createElement("div");promptElt.className="prompt";var promptTextElt=null;if(this.m_promptText.length!=0){promptTextElt=document.createElement("label");promptTextElt.appendChild(document.createTextNode(this.m_promptText));promptElt.appendChild(promptTextElt)}
var promptValueElt=document.createElement("input");promptValueElt.className="input-control";promptValueElt.type="text";promptValueElt.id=HTMLUtils.generateUniqueId();promptValueElt.style.width="80%";promptValueElt.value=this.m_promptValue;promptElt.appendChild(promptValueElt);if(promptTextElt!=null)
promptTextElt.htmlFor=promptValueElt.id;boxElt.appendChild(promptElt);this.m_promptValueElt=NodeRef.acquire(promptValueElt)}
if(this.m_checkText!==null){var checkElt=document.createElement("div");checkElt.className="check";var checkBoxElt=document.createElement("input");checkBoxElt.type="checkbox";checkBoxElt.defaultChecked=checkBoxElt.checked=this.m_checkValue;checkBoxElt.id=HTMLUtils.generateUniqueId();var checkTextElt=document.createElement("label");checkTextElt.htmlFor=checkBoxElt.id;checkTextElt.appendChild(document.createTextNode(this.m_checkText));checkElt.appendChild(checkBoxElt);checkElt.appendChild(checkTextElt);boxElt.appendChild(checkElt);this.m_checkValueElt=NodeRef.acquire(checkBoxElt)}
if(this.m_appendHTML!=""){var htmlElt=document.createElement("div");htmlElt.innerHTML=this.m_appendHTML;boxElt.appendChild(htmlElt)}
boxElt.appendChild(document.createElement("br"))},_getMaximumWidth:function(bodySize){return Math.floor((bodySize.width*65)/100)},_buildResult:function(btn){return new IDM.MessageBox.Result(btn,this.m_promptValueElt!=null?this.m_promptValueElt.getElement().value:null,this.m_checkValueElt!=null?this.m_checkValueElt.getElement().checked:null)},_destroy:function(){IDM.Dialog.prototype._destroy.call(this);this.m_promptValueElt=null;this.m_checkValueElt=null},_onShow:function(){if(this.m_promptValueElt!=null){var elt=this.m_promptValueElt.getElement();elt.focus();elt.select()}}}});IDM.MessageBox.Result=Class.define
({ctor:function(btn,promptValue,checkValue){IDM.MessageBox.Result.baseConstructor.call(this,btn);this.m_promptValue=promptValue;this.m_checkValue=checkValue},inherits:IDM.Dialog.Result,prototype:{getPromptValue:function(){return this.m_promptValue},getCheckValue:function(){return this.m_checkValue}}});IDM.ColorPickerDialog=Class.define
({ctor:function(){IDM.ColorPickerDialog.baseConstructor.call(this);this.setTitle("Sélection d'une couleur");this.setButtons([IDM.Dialog.Button.OK,IDM.Dialog.Button.CANCEL]);this.m_color=new Color(0,0,0);this.m_allowTransparent=false;this.m_allowCustomColor=true;this.m_allowCustomColorOverride=false;this.m_selElt=null},static:{s_palettes:null,s_allowCustomColor:null,s_recentColors:null,_onClickedColor:function(){this.m_dialog.m_color=this.m_color;var selElt=this.m_dialog.m_selElt.getElement();if(this.m_color==null)
selElt.style.backgroundColor="";else
selElt.style.backgroundColor=this.m_color.toHex();HTMLUtils.setElementText(selElt,HTMLUtils.getElementText(this));this.appendChild(selElt);selElt.style.display="block"}},inherits:IDM.Dialog,prototype:{getColor:function(){return this.m_color},setColor:function(color){if(!this.m_allowTransparent&&color==null)
color=new Color(0,0,0);this.m_color=color},setAllowTransparent:function(allow){this.m_allowTransparent=(allow?true:false)},getAllowTransparent:function(){return this.m_allowTransparent},setAllowCustomColor:function(allow){this.m_allowCustomColor=(allow?true:false);this.m_allowCustomColorOverride=true},getAllowCustomColor:function(){return this.m_allowCustomColor},_constructInner:function(contElt,boxElt){contElt.className+=" idm-colorpickerdialog";var paletteElt=document.createElement("div");boxElt.appendChild(paletteElt);paletteElt.className="palette";var selElt=document.createElement("div");paletteElt.appendChild(selElt);selElt.className="selection";selElt.style.display="none";this.m_selElt=NodeRef.create(selElt);if(IDM.ColorPickerDialog.s_palettes==null){var http=new HTTPRequest("/services/misc/colorpal.php");var response=http.sendSync();var dom=XMLUtils.createDocumentFromString(response);var rootNode=XMLUtils.getRootElement(dom);IDM.ColorPickerDialog.s_palettes=new ArrayList();IDM.ColorPickerDialog.s_allowCustomColor=true;if(rootNode!=null){var pals=XMLUtils.getChildrenByTagName(rootNode,"color-palette");IDM.ColorPickerDialog.s_allowCustomColor=(rootNode.getAttribute("allow-custom")=="true");for(var i=0;i<pals.length;++i)
IDM.ColorPickerDialog.s_palettes.add(ColorPalette.createFromXML(dom,pals[i]))}}
if(this.m_allowTransparent){var colorElt=document.createElement("div");paletteElt.appendChild(colorElt);colorElt.className="color transparent";colorElt.onclick=IDM.ColorPickerDialog._onClickedColor;colorElt.m_dialog=this;colorElt.m_color=null;HTMLUtils.setElementText(colorElt,"Aucune / transparent");if(this.m_color==null){colorElt.appendChild(selElt);selElt.style.display="block";HTMLUtils.setElementText(selElt,HTMLUtils.getElementText(colorElt))}}
var palette=(IDM.ColorPickerDialog.s_palettes.getCount()==0?null:IDM.ColorPickerDialog.s_palettes.getAt(0));if(palette!=null){for(var i=0,n=palette.getColorCount();i<n;++i){var clr=palette.getColorAt(i);var colorElt=document.createElement("div");paletteElt.appendChild(colorElt);colorElt.className="color type"+((i%5)+1)+" n"+i;colorElt.style.backgroundColor=clr.toHex();colorElt.onclick=IDM.ColorPickerDialog._onClickedColor;colorElt.m_dialog=this;colorElt.m_color=clr;if(this.m_color!=null&&this.m_color.equals(clr)){colorElt.appendChild(selElt);selElt.style.backgroundColor=clr.toHex();selElt.style.display="block";HTMLUtils.setElementText(selElt,HTMLUtils.getElementText(colorElt))}}}
if(!this.m_allowCustomColorOverride)
this.m_allowCustomColor=IDM.ColorPickerDialog.s_allowCustomColor;var breakElt=document.createElement("div");paletteElt.appendChild(breakElt);breakElt.style.clear="both";if(this.m_allowCustomColor){var moreElt=document.createElement("div");boxElt.appendChild(moreElt);moreElt.style.textAlign="right";moreElt.style.padding="10px 0px 10px 0px";var moreBtnElt=document.createElement("button");moreElt.appendChild(moreBtnElt);moreBtnElt.appendChild(document.createTextNode("Plus de couleurs..."));moreBtnElt.onclick=JSUtils.makeCallback(this,IDM.ColorPickerDialog.prototype._showCustomDialog);moreBtnElt.className="button-control"}
if(IDM.ColorPickerDialog.s_recentColors==null){var webs=new IDM.WebService(URL.parse("/shop/services/session/data/get-favorite-colors.php"));webs.call();if(webs.isSuccess()){var dom=webs.getResult();var rootNode=XMLUtils.getRootElement(dom);IDM.ColorPickerDialog.s_recentColors=ColorPalette.createFromXML(dom,rootNode)}else
{IDM.ColorPickerDialog.s_recentColors=new ColorPalette()}}
if(IDM.ColorPickerDialog.s_recentColors.getColorCount()!=0){var p=document.createElement("p");boxElt.appendChild(p);p.appendChild(document.createTextNode("Couleurs récemment utilisées :"));var recentElt=document.createElement("div");boxElt.appendChild(recentElt);recentElt.className="palette recent";for(var i=0,n=IDM.ColorPickerDialog.s_recentColors.getColorCount();i<n;++i){var color=IDM.ColorPickerDialog.s_recentColors.getColorAt(i);var colorElt=document.createElement("div");recentElt.appendChild(colorElt);colorElt.className="color type"+((i%5)+1)+" n"+i;colorElt.style.backgroundColor=color.toHex();colorElt.onclick=IDM.ColorPickerDialog._onClickedColor;colorElt.m_dialog=this;colorElt.m_color=color;if(this.m_color!=null&&this.m_color.equals(color)){colorElt.appendChild(selElt);selElt.style.backgroundColor=color.toHex();selElt.style.display="block";HTMLUtils.setElementText(selElt,HTMLUtils.getElementText(colorElt))}}
var breakElt=document.createElement("div");recentElt.appendChild(breakElt);breakElt.style.clear="both"}
this._setColor(this.m_color,false)},_onClickedButton:function(btn){if(btn==IDM.Dialog.Button.OK){if(this.m_color!=null){var pos=IDM.ColorPickerDialog.s_recentColors.findColor(this.m_color);if(pos==-1){IDM.ColorPickerDialog.s_recentColors.insertColor(0,this.m_color);if(IDM.ColorPickerDialog.s_recentColors.getColorCount()>20)
IDM.ColorPickerDialog.s_recentColors.removeColor(IDM.ColorPickerDialog.s_recentColors.getColorCount()-1)}else
{IDM.ColorPickerDialog.s_recentColors.removeColor(pos);IDM.ColorPickerDialog.s_recentColors.insertColor(0,this.m_color)}
var webs=new IDM.WebService(URL.parse("/shop/services/session/data/set-favorite-colors.php"));webs.setData(IDM.ColorPickerDialog.s_recentColors.writeToXMLDocument());JSUtils.invokeLater(JSUtils.makeCallback(webs,IDM.WebService.prototype.call))}}
return true},_setColor:function(color,eraseSelection){this.m_color=color;if(eraseSelection==window.undefined||eraseSelection==null||eraseSelection==true)
this.m_selElt.getElement().style.display="none"},_showCustomDialog:function(){var colorDlg=new IDM.CustomColorPickerDialog();var obj=this;var callback=function(dlg,result){if(result.getButton()!=IDM.Dialog.Button.CANCEL){obj._setColor(dlg.getColor());obj._clickButton(IDM.Dialog.Button.OK)}
return true}
colorDlg.setOnClickedButtonCallback(callback);colorDlg.setColor(this.m_color);colorDlg.show()}}});IDM.CustomColorPickerDialog=Class.define
({ctor:function(){IDM.CustomColorPickerDialog.baseConstructor.call(this);this.setTitle("Couleur personnalisée");this.setButtons([IDM.Dialog.Button.OK,IDM.Dialog.Button.CANCEL]);this.m_color=new Color(0,0,0);this.m_h=this.m_s=this.m_v=0;this.m_satColorElt=null;this.m_satDotElt=null;this.m_hueArrowElt=null;this.m_hueMouseDown=false;this.m_hueMouseUp=null;this.m_hueMouseMove=null;this.m_satMouseDown=false;this.m_satMouseUp=null;this.m_satMouseMove=null;this.m_colorElt=null;this.m_colorCodeElt=null;this.m_rgbElt=null},inherits:IDM.Dialog,prototype:{getColor:function(){return this.m_color},setColor:function(color){if(color==null)
color=new Color(0,0,0);this.m_color=color},_constructInner:function(contElt,boxElt){var pickerElt=document.createElement("div");boxElt.appendChild(pickerElt);pickerElt.style.position="relative";pickerElt.style.width="365px";pickerElt.style.height="220px";var satContElt=document.createElement("div");pickerElt.appendChild(satContElt);satContElt.style.position="absolute";satContElt.style.left="0px";satContElt.style.top="0px";satContElt.style.width="220px";satContElt.style.height="220px";var satColorElt=document.createElement("div");satContElt.appendChild(satColorElt);satColorElt.style.position="absolute";satColorElt.style.left="10px";satColorElt.style.top="10px";satColorElt.style.width="200px";satColorElt.style.height="200px";this.m_satColorElt=NodeRef.create(satColorElt);var satLayerElt=document.createElement("img");satContElt.appendChild(satLayerElt);satLayerElt.style.position="absolute";satLayerElt.style.left="0px";satLayerElt.style.top="0px";satLayerElt.style.width="220px";satLayerElt.style.height="220px";satLayerElt.style.cursor="pointer";satLayerElt.style.visibility="visible";satLayerElt.src="/styles/image.php?path=fw/colorpicker-satshade.png";satLayerElt.onmousedown=JSUtils.makeCallbackEvent(this,IDM.CustomColorPickerDialog.prototype._onMouseDownSat);satLayerElt.onmousemove=JSUtils.makeCallbackEvent(this,IDM.CustomColorPickerDialog.prototype._onMouseMoveSat);HTMLUtils.fixPNGImage(satLayerElt);var satDotElt=document.createElement("img");satContElt.appendChild(satDotElt);satDotElt.style.position="absolute";satDotElt.style.left="0px";satDotElt.style.top="0px";satDotElt.style.width="21px";satDotElt.style.height="21px";satDotElt.style.cursor="pointer";satDotElt.style.visibility="visible";satDotElt.src="/styles/image.php?path=fw/colorpicker-dot.png";satDotElt.onmousedown=JSUtils.makeCallbackEvent(this,IDM.CustomColorPickerDialog.prototype._onMouseDownSat);satDotElt.onmousemove=JSUtils.makeCallbackEvent(this,IDM.CustomColorPickerDialog.prototype._onMouseMoveSat);HTMLUtils.fixPNGImage(satDotElt);this.m_satDotElt=NodeRef.create(satDotElt);var hueElt=document.createElement("div");pickerElt.appendChild(hueElt);hueElt.style.position="absolute";hueElt.style.left="230px";hueElt.style.top="0px";hueElt.style.width="50px";hueElt.style.height="220px";hueElt.style.cursor="pointer";hueElt.onmousedown=JSUtils.makeCallbackEvent(this,IDM.CustomColorPickerDialog.prototype._onMouseDownHue);hueElt.onmousemove=JSUtils.makeCallbackEvent(this,IDM.CustomColorPickerDialog.prototype._onMouseMoveHue);HTMLUtils.setPNGBackground(hueElt,"/styles/image.php?path=fw/colorpicker-hueshade.png");var hueArrowElt=document.createElement("img");hueElt.appendChild(hueArrowElt);hueArrowElt.style.position="absolute";hueArrowElt.style.left="0px";hueArrowElt.style.top="0px";hueArrowElt.style.width="23px";hueArrowElt.style.height="21px";hueArrowElt.style.cursor="pointer";hueArrowElt.style.visibility="visible";hueArrowElt.src="/styles/image.php?path=fw/colorpicker-arrow.png";hueArrowElt.onmousedown=JSUtils.makeCallbackEvent(this,IDM.CustomColorPickerDialog.prototype._onMouseDownHue);hueArrowElt.onmousemove=JSUtils.makeCallbackEvent(this,IDM.CustomColorPickerDialog.prototype._onMouseMoveHue);HTMLUtils.fixPNGImage(hueArrowElt);this.m_hueArrowElt=NodeRef.create(hueArrowElt);var colorContElt=document.createElement("div");pickerElt.appendChild(colorContElt);colorContElt.style.position="absolute";colorContElt.style.left="300px";colorContElt.style.top="0px";colorContElt.style.width="65px";colorContElt.style.height="220px";var colorElt=document.createElement("div");colorContElt.appendChild(colorElt);colorElt.style.position="absolute";colorElt.style.left="10px";colorElt.style.top="10px";colorElt.style.width="45px";colorElt.style.height="200px";var colorLayerElt=document.createElement("img");colorContElt.appendChild(colorLayerElt);colorLayerElt.style.position="absolute";colorLayerElt.style.left="0px";colorLayerElt.style.top="0px";colorLayerElt.style.width="65px";colorLayerElt.style.height="220px";colorLayerElt.style.visibility="visible";colorLayerElt.src="/styles/image.php?path=fw/colorpicker-color.png";HTMLUtils.fixPNGImage(colorLayerElt);this.m_colorElt=NodeRef.create(colorElt);var colorCodeContElt=document.createElement("div");boxElt.appendChild(colorCodeContElt);colorCodeContElt.style.padding="10px";var colorCodeElt=document.createElement("input");colorCodeElt.className="input-control";colorCodeElt.size=8;colorCodeElt.onchange=JSUtils.makeCallback(this,IDM.CustomColorPickerDialog.prototype._onChangedColorCode);var rgbElt=document.createElement("span");colorCodeContElt.appendChild(HTMLUtils.createLabel(colorCodeElt,"Code couleur"+"\u00A0"+":"+"\u00A0",false));colorCodeContElt.appendChild(colorCodeElt);colorCodeContElt.appendChild(document.createTextNode("\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0"));colorCodeContElt.appendChild(rgbElt);this.m_colorCodeElt=NodeRef.create(colorCodeElt);this.m_rgbElt=NodeRef.create(rgbElt);this._setColor(this.m_color)},_moveSV:function(s,v,update){var x=10.0+(200.0*s)/100.0;var y=10.0+(200.0*(100.0-v))/100.0;var elt=this.m_satDotElt.getElement();HTMLUtils.setElementPos(elt,new Point(Math.floor(x-9),Math.floor(y-8)));if(update!==false){this.m_s=s;this.m_v=v;this._updateColor()}},_moveH:function(h,update){var y=10.0+(200.0*h)/360.0;var elt=this.m_hueArrowElt.getElement();HTMLUtils.setElementPos(elt,new Point(0,Math.floor(y-7)));this.m_satColorElt.getElement().style.backgroundColor=(Color.fromHSV(h,100,100)).toHex();if(update!==false){this.m_h=h;this._updateColor()}},_setColor:function(color){var hsv=color.toHSV();this._moveH(hsv[0]);this._moveSV(hsv[1],hsv[2]);this.m_color=color;var hsv=this.m_color.toHSV();this.m_h=hsv[0];this.m_s=hsv[1];this.m_v=hsv[2];this._updateColor()},_onMouseDownHue:function(ev){DOMEventUtils.stopPropagation(ev);this.m_hueMouseDown=true;this.m_hueMouseUp=document.onmouseup;this.m_hueMouseMove=document.onmousemove;document.onmouseup=JSUtils.makeCallbackEvent(this,IDM.CustomColorPickerDialog.prototype._onMouseUpHue);document.onmousemove=JSUtils.makeCallbackEvent(this,IDM.CustomColorPickerDialog.prototype._onMouseMoveHue);this._onMouseMoveHue(ev);return false},_onMouseMoveHue:function(ev){DOMEventUtils.stopPropagation(ev);if(this.m_hueMouseDown){var pos=DOMEventUtils.getRelativeMousePos(ev,this.m_hueArrowElt.getElement().parentNode);var h=Math.min(360.0,Math.max(0.0,((pos.y-10)*360.0)/200.0));this._moveH(h)}
return false},_onMouseUpHue:function(ev){DOMEventUtils.stopPropagation(ev);document.onmouseup=this.m_hueMouseUp;document.onmousemove=this.m_hueMouseMove;this.m_hueMouseDown=false;this.m_hueMouseUp=null;this.m_hueMouseMove=null;return false},_onMouseDownSat:function(ev){DOMEventUtils.stopPropagation(ev);this.m_satMouseDown=true;this.m_satMouseUp=document.onmouseup;this.m_satMouseMove=document.onmousemove;document.onmouseup=JSUtils.makeCallbackEvent(this,IDM.CustomColorPickerDialog.prototype._onMouseUpSat);document.onmousemove=JSUtils.makeCallbackEvent(this,IDM.CustomColorPickerDialog.prototype._onMouseMoveSat);this._onMouseMoveSat(ev);return false},_onMouseMoveSat:function(ev){DOMEventUtils.stopPropagation(ev);if(this.m_satMouseDown){var pos=DOMEventUtils.getRelativeMousePos(ev,this.m_satDotElt.getElement().parentNode);var s=Math.min(100.0,Math.max(0.0,((pos.x-10)*100.0)/200.0));var v=100.0-Math.min(100.0,Math.max(0.0,((pos.y-10)*100.0)/200.0));this._moveSV(s,v)}
return false},_onMouseUpSat:function(ev){DOMEventUtils.stopPropagation(ev);document.onmouseup=this.m_satMouseUp;document.onmousemove=this.m_satMouseMove;this.m_satMouseDown=false;this.m_satMouseUp=null;this.m_satMouseMove=null;return false},_onChangedColorCode:function(){var color=Color.fromHex(this.m_colorCodeElt.getElement().value);var hsv=color.toHSV();this._moveH(hsv[0],false);this._moveSV(hsv[1],hsv[2],false);this.m_h=hsv[0];this.m_s=hsv[1];this.m_v=hsv[2];this._updateColor(color)},_updateColor:function(color){if(color==window.undefined||color==null)
this.m_color=Color.fromHSV(this.m_h,this.m_s,this.m_v);else
this.m_color=color;this.m_colorElt.getElement().style.backgroundColor=this.m_color.toHex();this.m_colorCodeElt.getElement().value=this.m_color.toHex();HTMLUtils.setElementText(this.m_rgbElt.getElement(),"R : "+this.m_color.getRed()+", V : "+this.m_color.getGreen()
+", B : "+this.m_color.getBlue())}}});IDM.MediaDialog=Class.define
({ctor:function(mediaType,source,width,height,title){IDM.Dialog.call(this);this.m_mediaType=(mediaType?mediaType:IDM.MediaDialog.TYPE_NONE);this.m_source=(source?source:null);this.m_width=(width?width:null);this.m_height=(height?height:null);this.setTitle(title?title:"");this.setButtons([IDM.Dialog.Button.CLOSE])},inherits:IDM.Dialog,static:{TYPE_NONE:"application/x-none",TYPE_FLASH:"application/x-shockwave-flash",TYPE_IMAGE:"image"},prototype:{setMedia:function(mediaType,source,width,height){this.m_mediaType=mediaType;this.m_source=source;this.m_width=width;this.m_height=height},_constructInner:function(contElt,boxElt){var sourceElt=document.createElement("div");boxElt.appendChild(sourceElt);var tmp=StringUtils.explode("/",this.m_mediaType);var type=tmp[0];var subType=(tmp.length>=2?tmp[1]:"");if(this.m_mediaType==IDM.MediaDialog.TYPE_FLASH){var width=(this.m_width==null?100:this.m_width);var height=(this.m_height==null?100:this.m_height);sourceElt.id=HTMLUtils.generateUniqueId();sourceElt.style.width=width+"px";sourceElt.style.height=height+"px";var so=new SWFObject(this.m_source,"idmmediadialogflash",width,height,"9",null);so.addParam("wmode","opaque");so.addParam("scale","noscale");so.addParam("AllowScriptAccess","always");so.write(sourceElt.id)}else if(type==IDM.MediaDialog.TYPE_IMAGE){var width=(this.m_width==null?100:this.m_width);var height=(this.m_height==null?100:this.m_height);var imgElt=document.createElement("div");imgElt.className="preview-control";imgElt.style.width=width+"px";imgElt.style.height=height+"px";imgElt.style.backgroundImage="url("+this.m_source+")";imgElt.style.backgroundRepeat="no-repeat";imgElt.style.backgroundPosition="center center";sourceElt.appendChild(imgElt)}else
{HTMLUtils.setElementText(sourceElt,"Unsupported media type: '"+this.m_mediaType+"'.")}}}});IDM.AlignmentDialog=Class.define
({ctor:function(){IDM.Dialog.call(this);this.setTitle("Alignement");this.setButtons([IDM.Dialog.Button.OK,IDM.Dialog.Button.CANCEL]);this.m_oldAlign=this.m_align=IDM.Alignment.MIDDLE_CENTER;this.m_allowJustify=false;this.m_mode=IDM.AlignmentDialog.MODE_TEXT;this.m_curCellElt=null;this.declareSlot("alignment-changed")},inherits:IDM.Dialog,static:{MODE_TEXT:"txt",MODE_IMAGE:"img"},prototype:{setAlignment:function(align){this.m_align=align;this.m_oldAlign=this.m_align},getAlignment:function(){return this.m_align},setAllowJustify:function(allowJustify){this.m_allowJustify=allowJustify},getAllowJustify:function(){return this.m_allowJustify},setMode:function(mode){this.m_mode=mode},getMode:function(){return this.m_mode},_constructInner:function(contElt,boxElt){contElt.className+=" idm-alignmentdialog";var tableElt=document.createElement("table");boxElt.appendChild(tableElt);tableElt.style.borderCollapse="collapse";tableElt.style.borderSpacing="0";tableElt.cellSpacing=0;tableElt.cellPadding=0;var rowElt,cellElt;rowElt=tableElt.insertRow(0);cellElt=rowElt.insertCell(0);cellElt.appendChild(this._createCell(cellElt,"tl",IDM.Alignment.TOP_LEFT));cellElt=rowElt.insertCell(1);cellElt.appendChild(this._createCell(cellElt,"tc",IDM.Alignment.TOP_CENTER));cellElt=rowElt.insertCell(2);cellElt.appendChild(this._createCell(cellElt,"tr",IDM.Alignment.TOP_RIGHT));if(this.m_allowJustify){cellElt=rowElt.insertCell(3);cellElt.appendChild(this._createCell(cellElt,"tj",IDM.Alignment.TOP_JUSTIFY))}
rowElt=tableElt.insertRow(1);cellElt=rowElt.insertCell(0);cellElt.appendChild(this._createCell(cellElt,"cl",IDM.Alignment.MIDDLE_LEFT));cellElt=rowElt.insertCell(1);cellElt.appendChild(this._createCell(cellElt,"cc",IDM.Alignment.MIDDLE_CENTER));cellElt=rowElt.insertCell(2);cellElt.appendChild(this._createCell(cellElt,"cr",IDM.Alignment.MIDDLE_RIGHT));if(this.m_allowJustify){cellElt=rowElt.insertCell(3);cellElt.appendChild(this._createCell(cellElt,"cj",IDM.Alignment.MIDDLE_JUSTIFY))}
rowElt=tableElt.insertRow(2);cellElt=rowElt.insertCell(0);cellElt.appendChild(this._createCell(cellElt,"bl",IDM.Alignment.BOTTOM_LEFT));cellElt=rowElt.insertCell(1);cellElt.appendChild(this._createCell(cellElt,"bc",IDM.Alignment.BOTTOM_CENTER));cellElt=rowElt.insertCell(2);cellElt.appendChild(this._createCell(cellElt,"br",IDM.Alignment.BOTTOM_RIGHT));if(this.m_allowJustify){cellElt=rowElt.insertCell(3);cellElt.appendChild(this._createCell(cellElt,"bj",IDM.Alignment.BOTTOM_JUSTIFY))}},_createCell:function(cellElt,alignStr,align){var divElt=document.createElement("div");divElt.className="clickable-control cell "+alignStr;divElt.style.textAlign="center";divElt.style.padding="5px";var imgElt=document.createElement("img");imgElt.style.width=imgElt.style.height="50px";imgElt.align="absmiddle";imgElt.src="/styles/default/images/fw/align/align-"+this.m_mode+"-"+alignStr+".png";divElt.appendChild(imgElt);var ha,va;if(align&IDM.Alignment.LEFT)ha="À gauche";else if(align&IDM.Alignment.CENTER)ha="Centré";else if(align&IDM.Alignment.RIGHT)ha="À droite";else if(align&IDM.Alignment.JUSTIFY)ha="Justifié";if(align&IDM.Alignment.TOP)va="En haut";else if(align&IDM.Alignment.MIDDLE)va="Au milieu";else if(align&IDM.Alignment.BOTTOM)va="En bas";divElt.title=imgElt.alt=imgElt.title=ha+"\n"+va;divElt.onclick=JSUtils.makeCallback(this,IDM.AlignmentDialog.prototype._onClickedCell,align,NodeRef.create(divElt));if(align==this.m_align){HTMLUtils.addStyleClass(divElt,"selected");this.m_curCellElt=NodeRef.create(divElt)}
return divElt},_onClickedCell:function(align,cellElt){if(this.m_align==align)
return;this.m_align=align;this.getNamedSlot("alignment-changed").trigger(this.m_align);HTMLUtils.addStyleClass(cellElt.getElement(),"selected");if(this.m_curCellElt)
HTMLUtils.removeStyleClass(this.m_curCellElt.getElement(),"selected");this.m_curCellElt=cellElt},_onClickedButton:function(btn){if(btn==IDM.Dialog.Button.CANCEL){this.m_align=this.m_oldAlign;this.getNamedSlot("alignment-changed").trigger(this.m_align)}
return true}}});IDM.TextAttributesDialog=Class.define
({ctor:function(){IDM.TextAttributesDialog.baseConstructor.call(this);this.setTitle("Attributs du texte");this.setButtons([IDM.Dialog.Button.OK,IDM.Dialog.Button.CANCEL]);this.m_attribs=new IDM.TextAttributes();this.m_fontModules=["pm"];this.m_allowUnchangedFontOrStyle=false},inherits:IDM.Dialog,prototype:{setAttributes:function(attribs){this.m_attribs=attribs},getAttributes:function(){return this.m_attribs},addFontModule:function(module){this.m_fontModules[this.m_fontModules.length]="@"+module},_constructInner:function(contElt,boxElt){contElt.className+=" idm-textattributesdialog";var currentFont=this.m_attribs.getFont();var currentColor=this.m_attribs.getColor();var currentBackColor=this.m_attribs.getBackColor();var currentSize=this.m_attribs.getSize();var currentInterline=this.m_attribs.getInterline();var currentInterletter=this.m_attribs.getInterletter();this.m_allowUnchangedFontOrStyle=(currentFont==IDM.TextAttributes.UNDEFINED_VALUE);var fontFrameElt=HTMLUtils.createFieldSet("Police et style");boxElt.appendChild(fontFrameElt);var fontSelector=new FontChooserEx(this.m_fontModules,this.m_allowUnchangedFontOrStyle);fontSelector.setStandalone(true);var lst=new Object();lst.onItemsChanged=JSUtils.makeCallback(this,IDM.TextAttributesDialog.prototype._onFontItemsChanged);lst.onItemSelected=JSUtils.makeCallback(this,IDM.TextAttributesDialog.prototype._onFontSelected);fontSelector.addListener(lst);var styleSelector=new ChoiceBox();styleSelector.setStandalone(true);lst=new ChoiceBoxListener();lst.onItemSelected=JSUtils.makeCallback(this,IDM.TextAttributesDialog.prototype._onStyleSelected);styleSelector.addListener(lst);var p1=document.createElement("p");p1.appendChild(HTMLUtils.createLabel(fontSelector.getHTMLElement(),"Police : "));p1.appendChild(fontSelector.getHTMLElement());var p2=document.createElement("p");p2.appendChild(HTMLUtils.createLabel(styleSelector.getHTMLElement(),"Style : "));p2.appendChild(styleSelector.getHTMLElement());var d=document.createElement("div");d.style.width="250px";d.appendChild(p1);d.appendChild(p2);var previewElt=document.createElement("div");HTMLUtils.setElementSize(previewElt,new Size(170,70));previewElt.className="preview-control";var t=HTMLUtils.createTable([[d,previewElt]]);fontFrameElt.appendChild(t);this.m_fontSel=fontSelector;this.m_styleSel=styleSelector;this.m_previewElt=NodeRef.create(previewElt);this.m_fontSizeMode=new RadioButtonGroup();var sizeFrameElt=HTMLUtils.createFieldSet("Taille du texte");boxElt.appendChild(sizeFrameElt);var x1=HTMLUtils.createRadioWithLabel("fontsize","Automatique",(currentSize!==IDM.TextAttributes.UNDEFINED_VALUE&&currentSize<=0));var x2=HTMLUtils.createRadioWithLabel("fontsize","Définie : ",(currentSize!==IDM.TextAttributes.UNDEFINED_VALUE&&currentSize>0));var fontSizeElt=HTMLUtils.createInputElement(currentSize===IDM.TextAttributes.UNDEFINED_VALUE?"":NumberUtils.formatNumber(currentSize<=0?5:currentSize,3,null,null,true,true),5);var p=document.createElement("div");p.appendChild(x1[0]);p.appendChild(document.createTextNode("\u00A0\u00A0\u00A0\u00A0\u00A0"));p.appendChild(x2[0]);p.appendChild(fontSizeElt);p.appendChild(document.createTextNode(" mm"));sizeFrameElt.appendChild(p);this.m_fontSizeModeAutoElt=NodeRef.create(x1[1]);this.m_fontSizeModeUserElt=NodeRef.create(x2[1]);this.m_fontSizeElt=NodeRef.create(fontSizeElt);x1[1].onclick=JSUtils.makeCallback(this,IDM.TextAttributesDialog.prototype.onChangedFontSizeMode);x2[1].onclick=JSUtils.makeCallback(this,IDM.TextAttributesDialog.prototype.onChangedFontSizeMode);fontSizeElt.onchange=fontSizeElt.onblur=JSUtils.makeCallback(this,IDM.TextAttributesDialog.prototype.onChangedFontSize);var colorFrameElt=HTMLUtils.createFieldSet("Couleur");boxElt.appendChild(colorFrameElt);var textColor=new IDM.ColorChooser();textColor.setAllowTransparent(false);textColor.setColor(currentColor);textColor.getNamedSlot("color-changed").attach
(JSUtils.makeCallback(this,IDM.TextAttributesDialog.prototype.onChangedColor));var backColor=new IDM.ColorChooser();backColor.setAllowTransparent(true);backColor.setColor(currentBackColor);backColor.getNamedSlot("color-changed").attach
(JSUtils.makeCallback(this,IDM.TextAttributesDialog.prototype.onChangedColor));var p=document.createElement("div");p.appendChild(document.createTextNode("Texte : "));p.appendChild(textColor.getHTMLElement());p.appendChild(document.createTextNode("\u00A0\u00A0\u00A0\u00A0\u00A0"));p.appendChild(document.createTextNode("Fond : "));p.appendChild(backColor.getHTMLElement());colorFrameElt.appendChild(p);this.m_textColor=textColor;this.m_backColor=backColor;var spacingFrameElt=HTMLUtils.createFieldSet("Espacement");boxElt.appendChild(spacingFrameElt);var items=new ArrayList();if(this.m_allowUnchangedFontOrStyle)
items.add(new ChoiceBox.Item("",null));for(var i=10;i<80;i+=10)items.add(new ChoiceBox.Item(i+" %",i));for(var i=80;i<=120;i+=5)items.add(new ChoiceBox.Item(i+" %",i));for(var i=130;i<200;i+=10)items.add(new ChoiceBox.Item(i+" %",i));for(var i=200;i<400;i+=50)items.add(new ChoiceBox.Item(i+" %",i));for(var i=400;i<=600;i+=100)items.add(new ChoiceBox.Item(i+" %",i));this.m_interline=new ChoiceBox();this.m_interline.setStandalone(true);this.m_interline.setItems(items);this.m_interline.select(currentInterline===IDM.TextAttributes.UNDEFINED_VALUE?null:currentInterline);lst=new Object();lst.onItemSelected=JSUtils.makeCallback(this,IDM.TextAttributesDialog.prototype._onInterlineChanged);this.m_interline.addListener(lst);var interletterElt=HTMLUtils.createInputElement(currentInterletter===IDM.TextAttributes.UNDEFINED_VALUE?"":NumberUtils.formatNumber(currentInterletter,3,null,null,true,true),5);interletterElt.onchange=interletterElt.onblur=JSUtils.makeCallback(this,IDM.TextAttributesDialog.prototype.onChangedInterletter);this.m_interletterElt=NodeRef.create(interletterElt);var p=document.createElement("div");p.appendChild(document.createTextNode("Caractères : "));p.appendChild(interletterElt);p.appendChild(document.createTextNode(" mm"));p.appendChild(document.createTextNode("\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0"));p.appendChild(document.createTextNode("Interligne : "));p.appendChild(this.m_interline.getHTMLElement());spacingFrameElt.appendChild(p);this._onFontItemsChanged()},_onFontItemsChanged:function(){var currentFont=this.m_attribs.getFont();if(currentFont===IDM.TextAttributes.UNDEFINED_VALUE)
currentFont=null;var item=this.m_fontSel.selectFont(currentFont);if(item==null)
item=this.m_fontSel.getItems().getAt(0);if(item!=null){this._onFontSelected(item);var styleItem=this.m_styleSel.getSelectedItem();this._updateFontPreview(currentFont,(styleItem!=null?styleItem.getValue():0))}},_onStyleSelected:function(item){var fontItem=this.m_fontSel.getSelectedItem();this._updateFontPreview(fontItem==null?null:fontItem.getValue(),item.getValue());this._refresh()},_onFontSelected:function(item){var fontName=item.getValue();var entry=IDM.Font.fromString(fontName);var styleItems=new ArrayList();var styleCurItem=null;if(this.m_allowUnchangedFontOrStyle)
styleItems.add(new ChoiceBox.Item(" ",null));if(fontName!=null)
styleItems.add(new ChoiceBox.Item("Normal",0));if(fontName!=null&&entry!=null){var currentFont=this.m_attribs.getFont();var currentFontStyle=(currentFont===IDM.TextAttributes.UNDEFINED_VALUE?null:currentFont.getStyles().getAt(0));var styles=entry.getStyles();for(var i=0,n=styles.getCount();i<n;++i){var style=styles.getAt(i);var styleItem=null;if((style&IDM.Font.STYLE_BOLD)&&(style&IDM.Font.STYLE_ITALIC))
styleItem=new ChoiceBox.Item("Gras Italique",IDM.Font.STYLE_BOLD|IDM.Font.STYLE_ITALIC);else if(style&IDM.Font.STYLE_BOLD)
styleItem=new ChoiceBox.Item("Gras",IDM.Font.STYLE_BOLD);else if(style&IDM.Font.STYLE_ITALIC)
styleItem=new ChoiceBox.Item("Italique",IDM.Font.STYLE_ITALIC);if(styleItem!=null){styleItems.add(styleItem);if(styleItem.getValue()==currentFontStyle)
styleCurItem=styleItem}}}
this.m_styleSel.setItems(styleItems);if(styleCurItem!=null)
this.m_styleSel.setSelectedItem(styleCurItem);this._updateFontPreview(fontName,(styleCurItem!=null?styleCurItem.getValue():0));this._refresh()},_onInterlineChanged:function(item){this._refresh()},_updateFontPreview:function(fontName,style){this.m_previewElt.getElement().style.backgroundImage="url(/modules/text/_services/font.php?cmd=previewex"
+"&font="+escape(fontName)+"&style="+style+"&width=170&height=70)"},_onClickedButton:function(btn){this.m_inited=false;if(btn==IDM.Dialog.Button.OK){this.m_attribs=this._getCurrentAttributes()}
return true},onChangedFontSize:function(){this._refresh()},onChangedInterletter:function(){this._refresh()},onChangedColor:function(){this._refresh()},onChangedFontSizeMode:function(){this._refresh()},_getCurrentAttributes:function(){var attribs=this.m_attribs.clone();var fontItem=this.m_fontSel.getSelectedItem();var font=(fontItem==null?null:IDM.Font.fromString(fontItem.getValue()));var fontStyleItem=this.m_styleSel.getSelectedItem();var fontStyle=(fontStyleItem==null?null:fontStyleItem.getValue());if(fontStyle==null)
font=null;else if(font!=null)
font=font.getVariant(fontStyle);if(font==null)
attribs.setFont(IDM.TextAttributes.UNDEFINED_VALUE);else
attribs.setFont(font);var color=this.m_textColor.getColor();if(color==null)
attribs.setColor(IDM.TextAttributes.UNDEFINED_VALUE);else
attribs.setColor(color);var backColor=this.m_backColor.getColor();attribs.setBackColor(backColor);if(this.m_fontSizeModeAutoElt.getElement().checked){attribs.setSize(0)}else if(this.m_fontSizeModeUserElt.getElement().checked){var fontSizeStr=StringUtils.trim(this.m_fontSizeElt.getElement().value);if(fontSizeStr.length<1||NumberUtils.parseNumber(fontSizeStr)==null){attribs.setSize(IDM.TextAttributes.UNDEFINED_VALUE)}else
{var size=Math.max(4.0,NumberUtils.parseNumber(fontSizeStr));attribs.setSize(size)}}else
{attribs.setSize(IDM.TextAttributes.UNDEFINED_VALUE)}
var interlineItem=this.m_interline.getSelectedItem();var interline=(interlineItem==null?null:interlineItem.getValue());if(interline==null||parseInt(interline)==0)
attribs.setInterline(IDM.TextAttributes.UNDEFINED_VALUE);else
attribs.setInterline(parseInt(interline));var interletterStr=StringUtils.trim(this.m_interletterElt.getElement().value);if(interletterStr.length<1||NumberUtils.parseNumber(interletterStr)==null)
attribs.setInterletter(IDM.TextAttributes.UNDEFINED_VALUE);else
attribs.setInterletter(NumberUtils.parseNumber(interletterStr));return attribs},_refresh:function(){}}});IDM.ProgressDialog=Class.define
({ctor:function(mayCancel){IDM.ProgressDialog.baseConstructor.call(this);this.m_mayCancel=(mayCancel?true:false);if(this.m_mayCancel)
this.setButtons([IDM.Dialog.Button.CANCEL]);else
this.setButtons([]);this.m_progressBar=null;this.declareSlot("cancel-requested")},inherits:IDM.Dialog,prototype:{getProgressBar:function(){return this.m_progressBar},_constructInner:function(contElt,boxElt){var progressBar=IDM.ProgressBar.create(boxElt);progressBar.getElement().style.width="400px";this.m_progressBar=progressBar},_onClickedButton:function(btn){if(this.m_mayCancel){this.getNamedSlot("cancel-requested").trigger();return true}else
{return false}}}});IDM.HelpBubble=Class.define
({ctor:function(){this.m_cont=null;this.m_inner=null;this.m_inner2=null;this.m_cts=null;this.m_corners=null;this.m_top=null;this.m_bottom=null;this.m_visible=false;this.m_timeout=null},static:{create:function(){return new IDM.HelpBubble()},s_bubbles:[],get:function(name){if(!IDM.HelpBubble.s_bubbles[name])
IDM.HelpBubble.s_bubbles[name]=IDM.HelpBubble.create();return IDM.HelpBubble.s_bubbles[name]}},prototype:{_init:function(){if(this.m_cont!=null)
return;var elt=document.createElement("div");elt.className="idm-helpbubble";elt.style.position="absolute";elt.style.display="none";document.body.appendChild(elt);var top=document.createElement("div");top.className="idm-helpbubble-top";top.style.position="absolute";elt.appendChild(top);var bottom=document.createElement("div");bottom.className="idm-helpbubble-bottom";bottom.style.position="absolute";elt.appendChild(bottom);var inner=document.createElement("div");inner.className="idm-helpbubble-inner";inner.style.position="absolute";inner.style.left="0px";inner.style.top="0px";elt.appendChild(inner);var inner2=document.createElement("div");inner2.className="idm-helpbubble-inner2";inner2.style.position="absolute";inner2.style.left="0px";inner2.style.top="0px";inner.appendChild(inner2);var cts=document.createElement("div");cts.className="idm-helpbubble-contents";cts.style.position="absolute";inner2.appendChild(cts);this.m_corners=[];for(var i=0;i<4;++i){var cornerElt=document.createElement("img");cornerElt.style.position="absolute";elt.appendChild(cornerElt);this.m_corners[i]=NodeRef.create(cornerElt)}
var closeElt=document.createElement("img");closeElt.noiehack=true;closeElt.className="idm-helpbubble-close";closeElt.src="/styles/image.php?path=fw/helpbb-close.png";closeElt.style.position="absolute";closeElt.style.visibility="visible";elt.appendChild(closeElt);HTMLUtils.setupLineDiv(top);HTMLUtils.setupLineDiv(bottom);this.m_cont=NodeRef.create(elt);this.m_inner=NodeRef.create(inner);this.m_inner2=NodeRef.create(inner2);this.m_cts=NodeRef.create(cts);this.m_top=NodeRef.create(top);this.m_bottom=NodeRef.create(bottom);this.m_close=NodeRef.create(closeElt)},show:function(elt,zone,contents,boundingElt,delay){this._init();if(this.m_visible)
this.close();if(this.m_timeout){clearTimeout(this.m_timeout);this.m_timeout=null}
if(delay==window.undefined)
delay=10;var eltPos=HTMLUtils.getElementPos(elt);var eltSize=HTMLUtils.getElementSize(elt);var ex=eltPos.x+eltSize.width/2;var ey=eltPos.y+eltSize.height/2;var q=-1;var contElt=this.m_cont.getElement();var innerElt=this.m_inner.getElement();var inner2Elt=this.m_inner2.getElement();var ctsElt=this.m_cts.getElement();var topElt=this.m_top.getElement();var bottomElt=this.m_bottom.getElement();var closeElt=this.m_close.getElement();contElt.style.left="-10000px";contElt.style.top="-10000px";contElt.style.width=innerElt.style.width=inner2Elt.style.width="1000px";contElt.style.height="1000px";contElt.style.display="block";ctsElt.style.position="relative";ctsElt.style.display=(window.ActiveXObject?"inline":"table-cell");ctsElt.style.width="";ctsElt.style.height="";ctsElt.innerHTML=contents;var ctsSize=HTMLUtils.getElementSize(ctsElt);ctsElt.style.display="block";ctsElt.style.position="absolute";var bubbleSize=new Size(10+ctsSize.width+25+10,10+ctsSize.height+30);var bubbleOffset=new Point(-17,8);var bubblePos=new Point();if(q==-1){var boundSize,boundPos;if(boundingElt===window.undefined||boundingElt===null)
boundingElt=document.body;var boundSize=HTMLUtils.getElementSize(boundingElt);var boundPos=HTMLUtils.getElementPos(boundingElt);q=0;if(ex+bubbleOffset.x+bubbleSize.width>boundPos.x+boundSize.width)
q=1;if(ey+bubbleOffset.y+bubbleSize.height>boundPos.y+boundSize.height)
q=(q==0?3:2)}
if(q==0||q==3)
bubblePos.x=ex+bubbleOffset.x;else
bubblePos.x=ex-bubbleOffset.x-bubbleSize.width;if(q==0||q==1)
bubblePos.y=ey+bubbleOffset.y;else
bubblePos.y=ey-bubbleOffset.y-bubbleSize.height;var innerY=0;if(q==0||q==1)
innerY=30;else
innerY=10;var corners=[];switch(q){case 0:corners[0]=["nwp",0,0,40,30];corners[1]=["ne",bubbleSize.width-10,20,10,10];corners[2]=["se",bubbleSize.width-10,bubbleSize.height-10,10,10];corners[3]=["sw",0,bubbleSize.height-10,10,10];break;case 1:corners[0]=["nw",0,20,10,10];corners[1]=["nep",bubbleSize.width-40,0,40,30];corners[2]=["se",bubbleSize.width-10,bubbleSize.height-10,10,10];corners[3]=["sw",0,bubbleSize.height-10,10,10];break;case 2:corners[0]=["nw",0,0,10,10];corners[1]=["ne",bubbleSize.width-10,0,10,10];corners[2]=["sep",bubbleSize.width-40,bubbleSize.height-30,40,30];corners[3]=["sw",0,bubbleSize.height-30,10,10];break;case 3:corners[0]=["nw",0,0,10,10];corners[1]=["ne",bubbleSize.width-10,0,10,10];corners[2]=["se",bubbleSize.width-10,bubbleSize.height-30,10,10];corners[3]=["swp",0,bubbleSize.height-30,40,30];break}
for(var i=0;i<4;++i){var cornerElt=this.m_corners[i].getElement();var data=corners[i];cornerElt.noiehack=true;cornerElt.src="/styles/image.php?path=fw/helpbb-"+data[0]+".png";cornerElt.style.left=data[1]+"px";cornerElt.style.top=data[2]+"px";cornerElt.style.width=data[3]+"px";cornerElt.style.height=data[4]+"px";cornerElt.style.visibility="visible"}
HTMLUtils.setElementPos(topElt,new Point(corners[0][1]+corners[0][3],0));HTMLUtils.setElementSize(topElt,new Size(corners[1][1]-corners[0][1]-corners[0][3],Math.max(corners[0][4],corners[1][4])));HTMLUtils.setElementPos(bottomElt,new Point(corners[3][1]+corners[3][3],corners[3][2]));HTMLUtils.setElementSize(bottomElt,new Size(corners[2][1]-corners[3][1]-corners[3][3],Math.max(corners[3][4],corners[2][4])));HTMLUtils.setElementPos(innerElt,new Point(0,innerY));HTMLUtils.setElementSize(innerElt,new Size(bubbleSize.width,ctsSize.height));HTMLUtils.setElementPos(inner2Elt,new Point(0,0));HTMLUtils.setElementSize(inner2Elt,new Size(bubbleSize.width,ctsSize.height));HTMLUtils.setElementPos(ctsElt,new Point(10,0));HTMLUtils.setElementPos(contElt,bubblePos);HTMLUtils.setElementSize(contElt,bubbleSize);HTMLUtils.setElementPos(closeElt,new Point(bubbleSize.width-7-11,5+(q<=1?20:0)));contElt.onclick=JSUtils.makeCallback(this,IDM.HelpBubble.prototype.close);closeElt.onclick=JSUtils.makeCallback(this,IDM.HelpBubble.prototype.close);contElt.style.display="block";this.m_visible=true;if(delay>0)
this.m_timeout=setTimeout(JSUtils.makeCallback(this,IDM.HelpBubble.prototype.closeImpl),delay*1000)},close:function(){try
{if(this.m_timeout)
clearTimeout(this.m_timeout)}
catch(e){}
this.closeImpl()},closeImpl:function(){this.m_timeout=null;if(this.m_visible){this.m_cont.getElement().style.display="none";this.m_visible=false}},isVisible:function(){return this.m_visible}}});IDM.Accordion=Class.define
({ctor:function(){this.m_ori=IDM.Accordion.ORIENTATION_VERT;this.m_panels=new ArrayList();this.m_size=null;this.m_headerSize=null;this.m_panelSize=null;this.m_curPanel=null;this.m_moving=false},static:{ORIENTATION_HORZ:1,ORIENTATION_VERT:2,create:function(container,size,ori,headerSize){var accordion=new IDM.Accordion();if(ori!==window.undefined&&ori!==null)
accordion.m_ori=ori;accordion.m_size=size;accordion.m_panelSize=accordion.m_size.clone();accordion.m_headerSize=new Size(0,0);var panels=HTMLUtils.getChildrenElements(container,"div","panel");if(headerSize!==window.undefined){if(accordion.m_ori==IDM.Accordion.ORIENTATION_HORZ)
headerSize=new Size(headerSize,accordion.m_size.height);else
headerSize=new Size(accordion.m_size.width,headerSize)}
var longestTitle=null;for(var i=0,n=panels.length;i<n;++i){var title=panels[i].title;if(title&&(longestTitle==null||title.length>longestTitle.length))
longestTitle=title}
for(var i=0,n=panels.length;i<n;++i){var panel=IDM.Accordion.Panel.create
(panels[i],accordion.m_panels.getCount(),ori,headerSize,longestTitle);if(panel!=null){accordion.m_panels.add(panel);if(headerSize===window.undefined){var header=panel.getHeader();headerSize=HTMLUtils.getElementSize(header)}
accordion.m_headerSize=headerSize;accordion.m_panelSize.width-=headerSize.width;accordion.m_panelSize.height-=headerSize.height;HTMLUtils.setElementSize(panel.getContainer(),headerSize)}}
container.style.overflow="hidden";container.className="idm-accordion "
+(accordion.m_ori==IDM.Accordion.ORIENTATION_HORZ?"horz":"vert")
+" idm-accordion-"+(accordion.m_ori==IDM.Accordion.ORIENTATION_HORZ?"horz":"vert")
+" "+container.className;if(accordion.m_ori==IDM.Accordion.ORIENTATION_HORZ){var table=document.createElement("table");var row=table.insertRow(-1);for(var i=0,n=panels.length;i<n;++i){var cell=row.insertCell(i);cell.appendChild(panels[i]);cell.style.padding="0px";cell.style.border="0px solid black"}
container.appendChild(table);table.style.border="0px solid black";table.style.borderSpacing="0px";table.style.borderCollapse="collapse"}
accordion._initPanels();return accordion}},prototype:{getPanelCount:function(){return this.m_panels.getCount()},getPanelByIndex:function(index){return this.m_panels.getAt(index)},getPanelById:function(id){id=JSUtils.toString(id);for(var i=0,n=this.m_panels.getCount();i<n;++i){var panel=this.m_panels.getAt(i);if(panel.getId()==id)
return panel}
return null},showPanel:function(panel,callback){if(panel==this.m_curPanel){if(callback)
callback();return true}
if(this.m_moving)
return false;var pos=this.m_panels.find(panel);if(pos==-1)return false;var duration=100;var steps=10;this.m_moving=true;this._showPanelImpl(this.m_curPanel,panel,steps,duration,0,callback);return true},_showPanelImpl:function(oldPanel,newPanel,steps,duration,currentStep,callback){var stepDuration=Math.round(duration/steps);if(oldPanel!=null){var size=(this._getPanelSize()*(steps-currentStep))/steps;this._setPanelSize(oldPanel,size)}
var size=(this._getPanelSize()*currentStep)/steps;this._setPanelSize(newPanel,size);if(currentStep<steps){setTimeout(JSUtils.makeCallback(this,IDM.Accordion.prototype._showPanelImpl,oldPanel,newPanel,steps,duration,currentStep+1,callback),stepDuration)}else
{this.m_curPanel=newPanel;this.m_moving=false;if(callback){try
{callback()}
catch(e){}}}},_getPanelSize:function(){if(this.m_ori==IDM.Accordion.ORIENTATION_HORZ)
return this.m_panelSize.width;else
return this.m_panelSize.height},_setPanelSize:function(panel,size){var cont=panel.getContainer();var body=panel.getBody();if(this.m_ori==IDM.Accordion.ORIENTATION_HORZ){body.style.width=Math.round(size)+"px";cont.style.width=Math.round(size+this.m_headerSize.width)+"px"}else
{body.style.height=Math.round(size)+"px";cont.style.height=Math.round(size+this.m_headerSize.height)+"px"}},_initPanels:function(){var x=0,y=0;var defaultSize=this._getPanelSize();var headerPos=new Point(0,0);var bodyPos=null;if(this.m_ori==IDM.Accordion.ORIENTATION_HORZ)
bodyPos=new Point(this.m_headerSize.width,0);else
bodyPos=new Point(0,this.m_headerSize.height);for(var i=0,n=this.m_panels.getCount();i<n;++i){var panel=this.m_panels.getAt(i);var panelSize=new Size();var bodySize=new Size();if(i==0){this.m_curPanel=panel;if(this.m_ori==IDM.Accordion.ORIENTATION_HORZ){panelSize=new Size(this.m_headerSize.width+defaultSize,this.m_headerSize.height);bodySize=new Size(defaultSize,this.m_headerSize.height)}else
{panelSize=new Size(this.m_headerSize.width,this.m_headerSize.height+defaultSize);bodySize=new Size(this.m_headerSize.width,defaultSize)}}else
{panelSize=this.m_headerSize;if(this.m_ori==IDM.Accordion.ORIENTATION_HORZ)
bodySize=new Size(0,this.m_headerSize.height);else
bodySize=new Size(this.m_headerSize.width,0)}
var cont=panel.getContainer();var body=panel.getBody();var header=panel.getHeader();if(this.m_ori==IDM.Accordion.ORIENTATION_HORZ){panelSize.height=this.m_headerSize.height;bodySize.height=this.m_headerSize.height}
HTMLUtils.setElementSize(cont,panelSize);HTMLUtils.setElementSize(header,this.m_headerSize);HTMLUtils.setElementPos(header,headerPos);HTMLUtils.setElementSize(body,bodySize);HTMLUtils.setElementPos(body,bodyPos);if(this.m_ori==IDM.Accordion.ORIENTATION_HORZ)
x+=panelSize.width;else
y+=panelSize.height;header.style.textAlign="center";header.style.lineHeight=this.m_headerSize.height+"px";header.onclick=JSUtils.makeCallback(this,IDM.Accordion.prototype.showPanel,panel,null)}}}});IDM.Accordion.Panel=Class.define
({ctor:function(){this.m_container=null;this.m_header=null;this.m_body=null;this.m_index=-1;this.m_id=null},static:{createDOM:function(className,title,id){var panelElt=document.createElement("div");panelElt.className="panel"+(className!==window.undefined&&className!==null?" "+className:"");panelElt.title=(title?JSUtils.toString(title):null);panelElt.id="IDMAccordion"+NumberUtils.randomBigNumber()+"-"+(id?JSUtils.toString(id):"_"+NumberUtils.randomBigNumber());var headerElt=document.createElement("div");headerElt.className="header";headerElt.title=(title?JSUtils.toString(title):null);panelElt.appendChild(headerElt);var bodyElt=document.createElement("div");bodyElt.className="body";panelElt.appendChild(bodyElt);return{panel:panelElt,header:headerElt,body:bodyElt}},create:function(container,index,ori,headerSize,longestTitle){var header=HTMLUtils.getChildElement(container,"div","header");var body=HTMLUtils.getChildElement(container,"div","body");if(!header||!body)
return null;container.className="idm-accordion-panel "+container.className;container.style.position="relative";header.className="idm-accordion-panel-header "+header.className;header.style.position="absolute";header.style.overflow="hidden";body.className="idm-accordion-panel-body "+body.className;body.style.position="absolute";body.style.overflow="auto";var div=document.createElement("div");container.appendChild(div);div.style.position="relative";div.appendChild(header);div.appendChild(body);if(container.title&&NumberUtils.parseNumberSafe(HTMLUtils.getCurrentStyle(header,"text-indent"))==0){var img=document.createElement("div");img.className="title";img.style.width="100%";img.style.height="100%";img.style.backgroundPosition="50% 50%";img.style.backgroundRepeat="no-repeat";var color=CSSUtils.parseColor(HTMLUtils.getCurrentStyle(header,"color"));var url=new URL("/fw/accordion-header.php").addParam("title",StringUtils.encodeBase64(StringUtils.encodeUTF8(container.title))).addParam("longest-title",StringUtils.encodeBase64(StringUtils.encodeUTF8(longestTitle))).addParam("width",headerSize.width).addParam("height",headerSize.height).addParam("color",StringUtils.encodeBase64(color.toHex())).addParam("ori",ori);HTMLUtils.setPNGBackground(img,url.toString());header.appendChild(img)}
var panel=new IDM.Accordion.Panel();panel.m_container=NodeRef.create(container);panel.m_header=NodeRef.create(header);panel.m_body=NodeRef.create(body);panel.m_index=index;var tmp=StringUtils.explode("-",container.id);panel.m_id=(tmp.length==2?tmp[1]:null);return panel}},prototype:{getIndex:function(){return this.m_index},getId:function(){return this.m_id},getContainer:function(){return this.m_container.getElement()},getHeader:function(){return this.m_header.getElement()},getBody:function(){return this.m_body.getElement()}}});IDM.ProgressBar=Class.define
({ctor:function(){this.m_min=0;this.m_max=100;this.m_value=0;this.m_contElt=null;this.m_barElt=null;this.m_bar2Elt=null;this.m_mode=IDM.ProgressBar.MODE_NORMAL;this.m_timer=null},static:{MODE_NORMAL:1,MODE_INFINITE:2,create:function(parentElt){var contElt=document.createElement("div");contElt.className="idm-progressbar";parentElt.appendChild(contElt);var barElt=document.createElement("div");barElt.className="idm-progressbar-bar";contElt.appendChild(barElt);var bar2Elt=document.createElement("div");bar2Elt.className="idm-progressbar-bar";contElt.appendChild(bar2Elt);return IDM.ProgressBar.wrap(contElt)},wrap:function(contElt){var prgBar=new IDM.ProgressBar();var barElts=HTMLUtils.getChildrenElements(contElt);HTMLUtils.addStyleClass(barElts[0],"idm-progressbar-bar");HTMLUtils.addStyleClass(barElts[1],"idm-progressbar-bar");barElts[1].style.display="none";prgBar.m_contElt=NodeRef.create(contElt);prgBar.m_barElt=NodeRef.create(barElts[0]);prgBar.m_bar2Elt=NodeRef.create(barElts[1]);return prgBar}},prototype:{getElement:function(){return this.m_contElt.getElement()},getMin:function(){return this.m_min},setMin:function(min){this.m_min=min;this.repaint()},getMax:function(){return this.m_max},setMax:function(max){this.m_max=max;this.repaint()},setRange:function(min,max){this.m_min=min;this.m_max=max;this.repaint()},getValue:function(){return this.m_value},setValue:function(value){this.m_value=value;this.repaint()},repaint:function(){this._paint()},_paint:function(){var contElt=this.m_contElt.getElement();if(!contElt)return;var contSize=HTMLUtils.getElementSize(contElt);var barElt=this.m_barElt.getElement();var bar2Elt=this.m_bar2Elt.getElement();if(this.m_mode==IDM.ProgressBar.MODE_INFINITE){var barWidth=Math.round(contSize.width*0.4);var barLeft=Math.round((contSize.width*(this.m_infinitePos)/100.0-barWidth*0.5));barElt.style.left=barLeft+"px";barElt.style.width=barWidth+"px";if(barLeft<0)
bar2Elt.style.left=(contSize.width+barLeft)+"px";else
bar2Elt.style.left=-(contSize.width-barLeft)+"px";bar2Elt.style.width=barWidth+"px";bar2Elt.style.display=""}else
{var pct=((Math.abs(this.m_max-this.m_min)<=0.001)?0.0:((100.0*this.m_value)/(this.m_max-this.m_min)));var barWidth=Math.round(((contSize.width+1)*pct)/100.0);barElt.style.left="0px";barElt.style.width=barWidth+"px";bar2Elt.style.display="none"}},setMode:function(mode){this.m_mode=mode;if(mode==IDM.ProgressBar.MODE_INFINITE){this.m_infinitePos=0;this.m_timer=setTimeout(JSUtils.makeCallback(this,IDM.ProgressBar.prototype._modeInfinite),50)}else
{if(this.m_timer!=null){clearTimeout(this.m_timer);this.m_timer=null}}},_modeInfinite:function(){this._paint();this.m_infinitePos=(this.m_infinitePos+5)%100;this.m_timer=setTimeout(JSUtils.makeCallback(this,IDM.ProgressBar.prototype._modeInfinite),50)}}});IDM.Component=Class.define
({ctor:function(){IDM.Component.baseConstructor.call(this);this._m_elt=null;this._m_contElt=null;this.declareSlot("component-resized")},inherits:IDM.Object,static:{s_componentPoolElt:null,_getComponentPoolElement:function(){if(IDM.Component.s_componentPoolElt==null){var elt=document.createElement("div");elt.style.position="absolute";elt.style.overflow="hidden";HTMLUtils.setElementPos(elt,new Point(-1000,-1000));HTMLUtils.setElementSize(elt,new Size(200,200));document.body.appendChild(elt);IDM.Component.s_componentPoolElt=elt}
return IDM.Component.s_componentPoolElt}},prototype:{disable:function(){HTMLUtils.setElementDisabled(this.getInsideHTMLElement())},enable:function(){HTMLUtils.setElementEnabled(this.getInsideHTMLElement())},realize:function(){this.getHTMLElement()},getInsideHTMLElement:function(){return!this._isInlineComponent()?this.getHTMLElement().firstChild:this.getHTMLElement().firstChild.firstChild},getHTMLElement:function(){if(this._m_elt==null)
this._createImpl();return this._m_elt},resize:function(size){var elt=this.getHTMLElement();var contElt=this._m_contElt;HTMLUtils.setElementSize(contElt,size);this.getNamedSlot("component-resized").trigger()},_createImpl:function(){var elt=document.createElement("div");HTMLUtils.addStyleClass(elt,"idm-component");var htmlElt=null;if(this._isInlineComponent()){htmlElt=document.createElement("span");HTMLUtils.setElementInlineBlock(htmlElt);htmlElt.style.verticalAlign="middle";htmlElt.appendChild(elt)}else
{htmlElt=elt}
var poolElt=IDM.Component._getComponentPoolElement();poolElt.appendChild(htmlElt);this._create(elt);this._m_elt=htmlElt;this._m_contElt=elt;this.getNamedSlot("component-resized").trigger();return htmlElt},_isInlineComponent:function(){return true},_create:function(contElt){}}});IDM.Button=Class.define
({ctor:function(text){IDM.Button.baseConstructor.call(this);this.m_text=text;this.m_btnElt=null;this.declareSlot("button-clicked")},inherits:IDM.Component,prototype:{click:function(){this.getNamedSlot("button-clicked").trigger()},setText:function(text){this.m_text=text;if(this.m_btnElt)
HTMLUtils.setElementText(this.m_btnElt.getElement(),this.m_text)},_create:function(contElt){var btnElt=document.createElement("button");contElt.appendChild(btnElt);btnElt.className="button-control";btnElt.onclick=JSUtils.makeCallback(this,IDM.Button.prototype._onClicked);HTMLUtils.setElementText(btnElt,this.m_text);this.m_btnElt=NodeRef.create(btnElt)},_onClicked:function(){this.click()},isEnabled:function(){return HTMLUtils.isEnabled(this.getInsideHTMLElement())}}});IDM.TextComponent=Class.define
({ctor:function(){IDM.TextComponent.baseConstructor.call(this);this.declareSlot("text-changed");this.declareSlot("focus-lost");this.declareSlot("focus-got")},inherits:IDM.Component,prototype:{getText:function(){},setText:function(text){},setFocus:function(){}}});IDM.TextField=Class.define
({ctor:function(){IDM.TextField.baseConstructor.call(this);this.m_inputElt=null;this.m_text="";this.m_size=20},inherits:IDM.TextComponent,prototype:{getText:function(){return this.m_text},setText:function(text){this.m_text=text;if(this.m_inputElt)
this.m_inputElt.getElement().value=text},getSize:function(){return this.m_size},setSize:function(size){this.m_size=size},setFocus:function(){if(this.m_inputElt)
this.m_inputElt.getElement().focus()},_create:function(contElt){var inputElt=document.createElement("input");contElt.appendChild(inputElt);inputElt.className="input-control";inputElt.onkeyup=inputElt.onchange=JSUtils.makeCallback(this,IDM.TextField.prototype._onChange);inputElt.onblur=JSUtils.makeCallback(this,IDM.TextField.prototype._onBlur);inputElt.onfocus=JSUtils.makeCallback(this,IDM.TextField.prototype._onFocus);inputElt.size=this.m_size;inputElt.value=this.m_text;this.m_inputElt=NodeRef.create(inputElt)},_onChange:function(){this.m_text=StringUtils.encodeUTF8(this.m_inputElt.getElement().value);this.getNamedSlot("text-changed").trigger()},_onBlur:function(){this.m_text=StringUtils.encodeUTF8(this.m_inputElt.getElement().value);this.getNamedSlot("focus-lost").trigger()},_onFocus:function(){this.m_text=StringUtils.encodeUTF8(this.m_inputElt.getElement().value);this.getNamedSlot("focus-got").trigger()}}});IDM.TextArea=Class.define
({ctor:function(){IDM.TextArea.baseConstructor.call(this);this.m_inputElt=null;this.m_text="";this.m_cols=20;this.m_rows=5},inherits:IDM.TextComponent,prototype:{getText:function(){return this.m_text},setText:function(text){this.m_text=text;if(this.m_inputElt){var inputElt=this.m_inputElt.getElement();HTMLUtils.removeAllChildren(inputElt);inputElt.appendChild(document.createTextNode(this.m_text))}},getColumns:function(){return this.m_cols},setColumns:function(cols){this.m_cols=cols},getRows:function(){return this.m_rows},setRows:function(rows){this.m_rows=rows},setFocus:function(){if(this.m_inputElt)
this.m_inputElt.getElement().focus()},_create:function(contElt){var inputElt=document.createElement("textarea");contElt.appendChild(inputElt);inputElt.className="input-control multiline";inputElt.onkeyup=inputElt.onchange=JSUtils.makeCallback(this,IDM.TextArea.prototype._onChange);inputElt.onblur=JSUtils.makeCallback(this,IDM.TextArea.prototype._onBlur);inputElt.onfocus=JSUtils.makeCallback(this,IDM.TextArea.prototype._onFocus);inputElt.cols=this.m_cols;inputElt.rows=this.m_rows;HTMLUtils.removeAllChildren(inputElt);inputElt.appendChild(document.createTextNode(this.m_text));this.m_inputElt=NodeRef.create(inputElt)},_onChange:function(){this.m_text=this.m_inputElt.getElement().value;this.getNamedSlot("text-changed").trigger()},_onBlur:function(){this.m_text=this.m_inputElt.getElement().value;this.getNamedSlot("focus-lost").trigger()},_onFocus:function(){this.m_text=this.m_inputElt.getElement().value;this.getNamedSlot("focus-got").trigger()}}});IDM.Chooser=Class.define
({ctor:function(){IDM.Chooser.baseConstructor.call(this);this.declareSlot("item-selected");this.m_selectElt=null;this.m_items=new ArrayList()},inherits:IDM.Component,prototype:{getItemCount:function(){return this.m_items.getCount()},getItemAt:function(i){return this.m_items.getAt(i)},getItemByValue:function(val){for(var i=0,n=this.m_items.getCount();i<n;++i){var item=this.m_items.getAt(i);if(val==item.getValue())
return item}
return null},removeItem:function(item){this.m_items.remove(item);this._updateItems()},addItem:function(item){this.m_items.add(item);this._updateItems()},selectItem:function(item){var contElt=this.getHTMLElement();var selectElt=this.m_selectElt.getElement();var selItem=this.getSelectedItem();if(item==null){selectElt.selectedIndex=-1}else
{var i=this.m_items.find(item);selectElt.selectedIndex=i}
if(selItem!=this.getSelectedItem())
this._onSelectItem()},getSelectedItem:function(){var selectElt=this.m_selectElt.getElement();var index=selectElt.selectedIndex;if(index>=0&&index<this.m_items.getCount())
return this.m_items.getAt(index);return null},_create:function(contElt){var selectElt=document.createElement("select");contElt.appendChild(selectElt);selectElt.className="select-control";selectElt.onclick=selectElt.onkeyup=selectElt.onmouseup=JSUtils.makeCallback(this,IDM.Chooser.prototype._onSelectItem);this.m_selectElt=NodeRef.create(selectElt);this._updateItems()},_onSelectItem:function(){this.getNamedSlot("item-selected").trigger(this.getSelectedItem())},_updateItems:function(){if(!this.m_selectElt)
return;var selectElt=this.m_selectElt.getElement();var selItem=this.getSelectedItem();var items=this.m_items;var options=selectElt.options;for(var i=0,n=items.getCount();i<n;++i){var item=items.getAt(i);var sel=(selItem==item);options[i]=new Option(item.getText(),i,sel,sel)}
for(var j=i;j<options.length;++j)
options[j]=null;if(this.getSelectedItem()!=item)
this._onSelectItem()}}});IDM.Chooser.Item=Class.define
({ctor:function(text,value){this.m_text=text;this.m_value=(value!==window.undefined?value:text)},prototype:{getText:function(){return this.m_text},getValue:function(){return this.m_value}}});IDM.ColorChooser=Class.define
({ctor:function(){IDM.ColorChooser.baseConstructor.call(this);this.declareSlot("color-changed");this.m_color=new Color(0,0,0);this.m_allowTransparent=false;this.m_currentElt=null},inherits:IDM.Component,static:{_setColorImpl:function(contElt,color){if(color==null){contElt.style.backgroundColor="";contElt.style.backgroundImage="url(/styles/image.php?path=fw/clrsel-transparent.png)";contElt.style.backgroundRepeat="repeat"}else
{contElt.style.backgroundColor=color.toHex();contElt.style.backgroundImage=""}}},prototype:{getColor:function(){return this.m_color},setColor:function(color){if(!this.m_allowTransparent&&color==null)
color=new Color(0,0,0);this.m_color=color;var elt=this.getHTMLElement();IDM.ColorChooser._setColorImpl(this.m_currentElt.getElement().parentNode,color)},setAllowTransparent:function(allow){this.m_allowTransparent=(allow?true:false)},getAllowTransparent:function(){return this.m_allowTransparent},_create:function(contElt){HTMLUtils.addStyleClass(contElt,"idm-colorchooser");HTMLUtils.addStyleClass(contElt,"input-control");var curElt=document.createElement("div");curElt.className="idm-colorchooser-current";contElt.appendChild(curElt);IDM.ColorChooser._setColorImpl(contElt,this.m_color);this.m_currentElt=NodeRef.create(curElt);var buttonElt=document.createElement("div");contElt.appendChild(buttonElt);buttonElt.className="idm-colorchooser-button";contElt.onclick=JSUtils.makeCallback(this,IDM.ColorChooser.prototype._onClickedButton)},_onClickedButton:function(){var dlg=new IDM.ColorPickerDialog();dlg.setOnClickedButtonCallback(JSUtils.makeCallback(this,IDM.ColorChooser.prototype._onColorDialogClosed));dlg.setAllowTransparent(this.m_allowTransparent);dlg.setColor(this.getColor());dlg.show()},_onColorDialogClosed:function(dlg,result){if(result.getButton()!=IDM.Dialog.Button.CANCEL){var color=dlg.getColor();this.m_color=color;IDM.ColorChooser._setColorImpl(this.m_currentElt.getElement().parentNode,color);this.getNamedSlot("color-changed").trigger(color)}
return true}}});IDM.ThicknessChooser=Class.define
({ctor:function(){IDM.ThicknessChooser.baseConstructor.call(this);this.declareSlot("thickness-changed");this.m_thickness=0.5;this.m_thicknesses=[];this.m_color=null;this.m_currentElt=null;this.m_lineElt=null;this.m_textElt=null},inherits:IDM.Component,prototype:{getThickness:function(){return this.m_thickness},setThickness:function(thickness){this.m_thickness=this._adjustThickness(thickness);this._updateThickness()},setAllowedThicknesses:function(thicknessList){this.m_thicknesses=thicknessList},getAllowedThicknesses:function(){return this.m_thicknesses},setColor:function(color){this.m_color=color;this._updateThickness()},_adjustThickness:function(t){t=Math.max(0.0,t);if(this.m_thicknesses.length==0)
return t;var curDelta=424242.0;var curThickness=0.0;for(var i=0,n=this.m_thicknesses.length;i<n;++i){var thickness=this.m_thicknesses[i];var delta=Math.abs(thickness-t);if(delta<curDelta){curDelta=delta;curThickness=thickness}}
return curThickness},_create:function(contElt){HTMLUtils.addStyleClass(contElt,"idm-thicknesschooser");HTMLUtils.addStyleClass(contElt,"input-control");var innerElt=document.createElement("div");innerElt.className="idm-thicknesschooser-inner";contElt.appendChild(innerElt);var curElt=document.createElement("div");curElt.className="idm-thicknesschooser-current";innerElt.appendChild(curElt);this.m_currentElt=NodeRef.create(curElt);var lineElt=document.createElement("img");lineElt.src="/styles/default/images/page/spacer.png";lineElt.align="absmiddle";lineElt.className="line";curElt.appendChild(lineElt);this.m_lineElt=NodeRef.create(lineElt);var textElt=document.createElement("span");textElt.className="text";curElt.appendChild(textElt);this.m_textElt=NodeRef.create(textElt);var buttonsElt=document.createElement("div");innerElt.appendChild(buttonsElt);buttonsElt.className="idm-thicknesschooser-buttons";var plusBtnElt=document.createElement("button");plusBtnElt.className="button-control plus";plusBtnElt.onclick=JSUtils.makeCallback(this,IDM.ThicknessChooser.prototype._onClickedButtonPlus);HTMLUtils.setElementText(plusBtnElt,"+");var minusBtnElt=document.createElement("button");minusBtnElt.className="button-control minus";minusBtnElt.onclick=JSUtils.makeCallback(this,IDM.ThicknessChooser.prototype._onClickedButtonMinus);HTMLUtils.setElementText(minusBtnElt,"-");buttonsElt.appendChild(plusBtnElt);buttonsElt.appendChild(minusBtnElt);this._updateThickness()},_onClickedButtonPlus:function(){var thickness=0;if(this.m_thicknesses.length==0){thickness=this.m_thickness+0.5}else
{}
this.setThickness(thickness);this.getNamedSlot("thickness-changed").trigger(thickness)},_onClickedButtonMinus:function(){var thickness=0;if(this.m_thicknesses.length==0){thickness=this.m_thickness-0.5}else
{}
this.setThickness(thickness);this.getNamedSlot("thickness-changed").trigger(thickness)},_onClickedButton:function(){var dlg=new IDM.ThicknessPickerDialog();dlg.setOnClickedButtonCallback(JSUtils.makeCallback(this,IDM.ThicknessChooser.prototype._onThicknessDialogClosed));dlg.setAllowTransparent(this.m_allowTransparent);dlg.setThickness(this.getThickness());dlg.show()},_onThicknessDialogClosed:function(dlg,result){if(result.getButton()!=IDM.Dialog.Button.CANCEL){var thickness=dlg.getThickness();this.setThickness(thickness);this.getNamedSlot("thickness-changed").trigger(thickness)}
return true},_updateThickness:function(){if(!this.m_currentElt)
return;var contElt=this.m_currentElt.getElement();var lineColor=(this.m_color!=null?this.m_color:CSSUtils.parseColor(HTMLUtils.getCurrentStyle(contElt,"color")));HTMLUtils.setElementText(this.m_textElt.getElement(),Math.abs(this.m_thickness)<=0.001?"aucune":NumberUtils.formatNumber(this.m_thickness,1,null,null,true,true)+" mm");var lineWidth=(Math.abs(this.m_thickness)<=0.001?0:Math.max(1,Math.min(15,Math.round(this.m_thickness))));var lineElt=this.m_lineElt.getElement();lineElt.height=lineWidth;lineElt.style.backgroundColor=lineColor.toHex();lineElt.style.display=(Math.abs(this.m_thickness)<=0.001?"none":"")}}});IDM.TabControl=Class.define
({ctor:function(){IDM.TabControl.baseConstructor.call(this);this.declareSlot("tab-clicked");this.m_tabs=new ArrayList();this.m_selectedTab=null;this.m_prevSelectedTab=null;this.m_headerElt=null;this.m_bodyElt=null;this.m_bodyOuterElt=null;this.m_bodyInnerElt=null;this.m_bodySize=null;this.m_bodySizeTabCount=-1;this.m_mode=IDM.TabControl.MODE_TAB;this.m_headerPosition=IDM.TabControl.HEADER_POSITION_TOP;this.m_updateStylesDelayedTimeout=null;this.m_autoScrollDelay=0;this.m_autoScrollTimeout=null;this.m_autoSize=true;this.m_inUpdateStyles=false},inherits:IDM.Component,static:{MODE_TAB:0,MODE_CAROUSEL:1,HEADER_POSITION_TOP:0,HEADER_POSITION_BOTTOM:1},prototype:{_isInlineComponent:function(){return false},_create:function(contElt){HTMLUtils.addStyleClass(contElt,"idm-tab-control");HTMLUtils.removeStyleClass(contElt,"idm-tab-control-hp*");HTMLUtils.addStyleClass(contElt,"idm-tab-control-hp"+this.m_headerPosition);var headerElt=document.createElement("div");headerElt.className="header";var bodyElt=document.createElement("div");bodyElt.className="body";var bodyOuterElt=document.createElement("div");bodyOuterElt.className="outer";bodyElt.appendChild(bodyOuterElt);var bodyInnerElt=document.createElement("div");bodyInnerElt.className="inner";bodyOuterElt.appendChild(bodyInnerElt);if(this.m_headerPosition==IDM.TabControl.HEADER_POSITION_TOP){contElt.appendChild(headerElt);contElt.appendChild(bodyElt)}else
{contElt.appendChild(bodyElt);contElt.appendChild(headerElt)}
this.m_headerElt=NodeRef.create(headerElt);this.m_bodyElt=NodeRef.create(bodyElt);this.m_bodyOuterElt=NodeRef.create(bodyOuterElt);this.m_bodyInnerElt=NodeRef.create(bodyInnerElt);var leftArrowElt=document.createElement("div");leftArrowElt.className="left-arrow";leftArrowElt.style.display=(this.m_mode==IDM.TabControl.MODE_TAB?"none":"");leftArrowElt.onclick=JSUtils.makeCallbackEvent(this,IDM.TabControl.prototype._onClickedLeftArrow);var rightArrowElt=document.createElement("div");rightArrowElt.className="right-arrow";rightArrowElt.style.display=(this.m_mode==IDM.TabControl.MODE_TAB?"none":"");rightArrowElt.onclick=JSUtils.makeCallbackEvent(this,IDM.TabControl.prototype._onClickedRightArrow);headerElt.appendChild(leftArrowElt);headerElt.appendChild(rightArrowElt);this.m_leftArrowElt=NodeRef.create(leftArrowElt);this.m_rightArrowElt=NodeRef.create(rightArrowElt);headerElt.onmousedown=headerElt.onmouseup=headerElt.ondblclick=JSUtils.IGNORE_EVENT_FUNCTION;this._updateCSSClass(contElt)},getAutoSize:function(){return this.m_autoSize},setAutoSize:function(autoSize){this.m_autoSize=(autoSize?true:false)},getHeaderPosition:function(){return this.m_headerPosition},setHeaderPosition:function(headerPos){this.m_headerPosition=headerPos;if(this.m_headerElt){var headerElt=this.m_headerElt.getElement();var bodyElt=this.m_bodyElt.getElement();var contElt=headerElt.parentNode;if(headerPos==IDM.TabControl.HEADER_POSITION_TOP){contElt.appendChild(headerElt);contElt.appendChild(bodyElt)}else
{contElt.appendChild(bodyElt);contElt.appendChild(headerElt)}}},getMode:function(){return this.m_mode},setMode:function(mode){this.m_mode=mode;if(this.m_leftArrowElt){if(mode==IDM.TabControl.MODE_TAB){this.m_leftArrowElt.getElement().style.display="none";this.m_rightArrowElt.getElement().style.display="none"}else
{this.m_leftArrowElt.getElement().style.display="";this.m_rightArrowElt.getElement().style.display=""}}
this._updateCSSClass(this.getHTMLElement())},enableAutoScroll:function(delay){this.m_autoScrollDelay=Math.max(500,delay);this._resetAutoScroll()},disableAutoScroll:function(){if(this.m_autoScrollTimeout==null)
return;clearTimeout(this.m_autoScrollTimeout);this.m_autoScrollDelay=0;this.m_autoScrollTimeout=null},getSelectedTab:function(){return this.m_selectedTab},getTabCount:function(){return this.m_tabs.getCount()},getTabAt:function(index){return this.m_tabs.getAt(index)},appendTab:function(tab){var tabHeaderLeftElt=document.createElement("span");tabHeaderLeftElt.className="left";var tabHeaderMiddleElt=document.createElement("span");tabHeaderMiddleElt.className="middle";var tabHeaderRightElt=document.createElement("span");tabHeaderRightElt.className="right";var tabHeaderElt=document.createElement("span");tabHeaderElt.appendChild(tabHeaderLeftElt);tabHeaderElt.appendChild(tabHeaderMiddleElt);tabHeaderElt.appendChild(tabHeaderRightElt);tabHeaderMiddleElt.appendChild(tab.getTitleElement().getElement());tab.setHeaderElement(NodeRef.create(tabHeaderElt));var tabBodyElt=tab.getBodyElement().getElement();var tabInfosElt=tab.getInfosElement();var tabInfosSize=new Size(0,0);if(tabInfosElt!=null){var tabInfosContElt=document.createElement("div");tabInfosContElt.className="tab-infos";tabInfosContElt.appendChild(tabInfosElt.getElement());this.m_bodyElt.getElement().insertBefore(tabInfosContElt,this.m_bodyElt.getElement().firstChild);tabInfosSize=HTMLUtils.getElementSize(tabInfosContElt)}
var headerElt=this.m_headerElt.getElement();headerElt.appendChild(tabHeaderElt);headerElt.appendChild(this.m_rightArrowElt.getElement());this.m_bodyInnerElt.getElement().appendChild(tabBodyElt);tabHeaderLeftElt.onclick=tabHeaderMiddleElt.onclick=tabHeaderRightElt.onclick=tabHeaderLeftElt.onmousedown=tabHeaderMiddleElt.onmousedown=tabHeaderRightElt.onmousedown=JSUtils.makeCallbackEvent(this,IDM.TabControl.prototype._onClickedTabHeader,tab);this.m_tabs.add(tab);this._updateStylesDelayed()},findTabIndex:function(tab){return this._findTabIndex(tab)},selectTab:function(tab,animate){if(this.m_selectedTab==tab)
return false;this._updateStyles(tab,animate);return true},getBodyHTMLElement:function(){return this.m_bodyElt.getElement()},getHeaderHTMLElement:function(){return this.m_headerElt.getElement()},_onClickedLeftArrow:function(ev){DOMEventUtils.stopPropagation(ev);var index=(this.m_selectedTab==null?0:this._findTabIndex(this.m_selectedTab));index=(index==0?this.m_tabs.getCount()-1:(index-1)%this.m_tabs.getCount());this.disableAutoScroll();this.selectTab(this.m_tabs.getAt(index),true);return false},_onClickedRightArrow:function(ev){DOMEventUtils.stopPropagation(ev);var index=(this.m_selectedTab==null?0:this._findTabIndex(this.m_selectedTab));index=(index+1)%this.m_tabs.getCount();this.disableAutoScroll();this.selectTab(this.m_tabs.getAt(index),true);return false},_findTabIndex:function(tab){for(var i=0,n=this.m_tabs.getCount();i<n;++i){if(this.m_tabs.getAt(i)==tab)
return i}
return-1},_autoScroll:function(){var index=(this.m_selectedTab==null?0:this._findTabIndex(this.m_selectedTab));index=(index+1)%this.m_tabs.getCount();this.selectTab(this.m_tabs.getAt(index),true)},_resetAutoScroll:function(){if(this.m_autoScrollTimeout)
clearTimeout(this.m_autoScrollTimeout);this.m_autoScrollTimeout=setInterval
(JSUtils.makeCallback(this,IDM.TabControl.prototype._autoScroll),this.m_autoScrollDelay)},_onClickedTabHeader:function(tab,ev){DOMEventUtils.stopPropagation(ev);this.disableAutoScroll();this.selectTab(tab);return false},_updateCSSClass:function(contElt){if(this.m_mode==IDM.TabControl.MODE_TAB){HTMLUtils.addStyleClass(contElt,"mode-tab");HTMLUtils.removeStyleClass(contElt,"mode-carousel")}else
{HTMLUtils.addStyleClass(contElt,"mode-carousel");HTMLUtils.removeStyleClass(contElt,"mode-tab")}},_updateStylesDelayed:function(){if(this.m_updateStylesDelayedTimeout!=null)
clearTimeout(this.m_updateStylesDelayedTimeout);this.m_updateStylesDelayedTimeout=setTimeout
(JSUtils.makeCallback(this,IDM.TabControl.prototype._updateStylesDelayedImpl),100)},_updateStylesDelayedImpl:function(){this.m_updateStylesDelayedTimeout=null;this._updateStyles()},_updateStyles:function(selTab,animate){if(this.m_tabs.isEmpty())
return;if(this.m_inUpdateStyles)
return;this.m_inUpdateStyles=true;var anims=new ArrayList();var selectedTab=(selTab?selTab:this.m_selectedTab);if(selectedTab==null)
selectedTab=this.m_tabs.getAt(0);this.m_selectedTab=selectedTab;var contElt=this.getHTMLElement();var bodyElt=this.m_bodyElt.getElement();var bodyInnerElt=this.m_bodyInnerElt.getElement();var bodyOuterElt=this.m_bodyOuterElt.getElement();var headerElt=this.m_headerElt.getElement();var bodyPadding=new Rect
(parseInt(HTMLUtils.getCurrentStyle(bodyOuterElt,"padding-left")),parseInt(HTMLUtils.getCurrentStyle(bodyOuterElt,"padding-top")),parseInt(HTMLUtils.getCurrentStyle(bodyOuterElt,"padding-right")),parseInt(HTMLUtils.getCurrentStyle(bodyOuterElt,"padding-bottom")));var recomputeBodySize=true;if(this.m_bodySizeTabCount==this.m_tabs.getCount()&&this.m_bodySize!=null)
recomputeBodySize=false;this.m_bodySizeTabCount=this.m_tabs.getCount();if(this.m_bodySize==null)
this.m_bodySize=new Size(250,100);for(var i=0,n=this.m_tabs.getCount();i<n;++i){var prevTab=(i-1>=0?this.m_tabs.getAt(i-1):null);var tab=this.m_tabs.getAt(i);var nextTab=(i+1<n?this.m_tabs.getAt(i+1):null);var styles=["tab"];if(i==0)
styles[styles.length]="first";else if(i==n-1)
styles[styles.length]="last";if(selectedTab==tab)
styles[styles.length]="selected";else
styles[styles.length]="not-selected";if(selectedTab==prevTab)
styles[styles.length]="previous-is-selected";else if(selectedTab==nextTab)
styles[styles.length]="next-is-selected";var tabHeaderElt=tab.getHeaderElement().getElement();tabHeaderElt.className=StringUtils.implode(" ",styles);var tabBodyElt=tab.getBodyElement().getElement();var tabBodySize=(tabBodyElt.m_sizeComputed?this.m_bodySize:HTMLUtils.getElementOuterSize(tabBodyElt));if(this.m_mode==IDM.TabControl.MODE_CAROUSEL&&animate===true){if(selectedTab==tab){var anim=new IDM.Animation.ProgressiveShow();anim.setup(tabBodyElt);anims.add(anim);HTMLUtils.setElementOpacity(tabBodyElt,0);tabBodyElt.style.visibility=""}else if(tab==this.m_prevSelectedTab){var hideBodyElt=tabBodyElt;var hideBodyFct=function(){HTMLUtils.setElementPos(hideBodyElt,new Point(-10000,-10000));hideBodyElt.style.visibility="hidden"}
var anim=new IDM.Animation.ProgressiveHide();anim.setup(tabBodyElt);anim.getNamedSlot("animation-finished").attach(hideBodyFct);anims.add(anim);tabBodyElt.style.visibility=""}else
{HTMLUtils.setElementOpacity(tabBodyElt,0)}
HTMLUtils.setElementPos(tabBodyElt,new Point(0,0))}else
{tabBodyElt.style.visibility=(selectedTab==tab?"":"hidden");HTMLUtils.setElementOpacity(tabBodyElt,100);if(selectedTab==tab)
HTMLUtils.setElementPos(tabBodyElt,new Point(0,0));else
HTMLUtils.setElementPos(tabBodyElt,new Point(-10000,-10000))}
tabBodyElt.m_sizeComputed=true;var tabInfosElt=tab.getInfosElement();var tabInfosSize=new Size(0,0);if(tabInfosElt){tabInfosElt=tabInfosElt.getElement();tabInfosElt.parentNode.style.display=(selectedTab==tab?"":"none");tabInfosSize=HTMLUtils.getElementSize(tabInfosElt);tabInfosSize.width=tabBodySize.width;tabInfosElt.parentNode.style.width=(this.m_bodySize.width+bodyPadding.x1+bodyPadding.x2)+"px"}
if(recomputeBodySize){this.m_bodySize.width=Math.max(this.m_bodySize.width,Math.max(tabBodySize.width,tabInfosSize.width));this.m_bodySize.height=Math.max(this.m_bodySize.height,tabBodySize.height+tabInfosSize.height)}
if(this.m_autoSize)
tabBodyElt.style.width="";else
tabBodyElt.style.width="100%"}
var bodyBorders=HTMLUtils.getElementBorders(bodyElt);var bodySize=this.m_bodySize.clone();bodySize.width+=bodyPadding.x1+bodyPadding.x2;bodySize.height+=bodyPadding.y1+bodyPadding.y2+bodyBorders.y1+bodyBorders.y2;if(this.m_autoSize){HTMLUtils.setElementSize(bodyElt,bodySize)}else
{bodyElt.style.width=""}
var headerSize=HTMLUtils.getElementSize(headerElt);var contSize=bodySize.clone();contSize.width+=bodyBorders.x1+bodyBorders.x2;contSize.height+=headerSize.height+bodyBorders.y1+bodyBorders.y2;if(this.m_autoSize){HTMLUtils.setElementSize(contElt,contSize)}else
{contElt.style.width="";contElt.style.height="auto"}
this.m_prevSelectedTab=this.m_selectedTab;if(!anims.isEmpty()){var mslot=new IDM.MultiSlot();var this_=this;mslot.attach
(function(){this_.m_inUpdateStyles=false});for(var i=0,n=anims.getCount();i<n;++i){var anim=anims.getAt(i);mslot.addSlot(anim.getNamedSlot("animation-finished"))}
for(var i=0,n=anims.getCount();i<n;++i){var anim=anims.getAt(i);anim.start()}}else
{this.m_inUpdateStyles=false}}}});IDM.TabControl.Tab=Class.define
({ctor:function(){this.m_headerElt=null;this.m_titleElt=null;this.m_bodyElt=null;this.m_infos=null;this.m_infosElt=window.undefined},static:{create:function(titleElt,bodyElt,infos){var tab=new IDM.TabControl.Tab();tab.m_titleElt=NodeRef.create(titleElt);tab.m_bodyElt=NodeRef.create(bodyElt);tab.m_infos=infos;bodyElt.style.position="absolute";bodyElt.style.left="0px";bodyElt.style.top="0px";return tab}},prototype:{getHeaderElement:function(){return this.m_headerElt},setHeaderElement:function(headerElt){this.m_headerElt=headerElt},getTitleElement:function(){return this.m_titleElt},getBodyElement:function(){return this.m_bodyElt},getInfosElement:function(){if(this.m_infosElt===window.undefined){if(this.m_infos){var infosElt=document.createElement("span");infosElt.appendChild(document.createTextNode(this.m_infos));IDM.Component._getComponentPoolElement().appendChild(infosElt);this.m_infosElt=NodeRef.create(infosElt)}else
{this.m_infosElt=null}}
return this.m_infosElt}}});IDM.ScrollerControl=Class.define
({ctor:function(){IDM.ScrollerControl.baseConstructor.call(this);this.declareSlot("item-clicked");this.m_ori=IDM.ScrollerControl.ORIENTATION_HORZ;this.m_contElt=null;this.m_leftElt=null;this.m_leftOvyElt=null;this.m_bodyElt=null;this.m_bodyInnerElt=null;this.m_bodyTableElt=null;this.m_rightElt=null;this.m_rightOvyElt=null;this.m_scrollSize=0;this.m_scrollContSize=0;this.m_scrollPos=0;this.m_dir=-1;this.m_speed=3;this.m_speedFactor=1.0;this.m_autoSwap=true;this.m_animTimer=null;this.m_autoScroll=true;this.m_overArrow=false;this.m_overBody=false;this.m_rebuildItemsTimeout=null;this.m_items=new ArrayList();this.getNamedSlot("component-resized").attach
(JSUtils.makeCallback(this,IDM.ScrollerControl.prototype._resize))},inherits:IDM.Component,static:{ORIENTATION_HORZ:1,ORIENTATION_VERT:2},prototype:{getOrientation:function(){return this.m_ori},setOrientation:function(ori){if(ori==IDM.ScrollerControl.ORIENTATION_VERT)
this.m_ori=IDM.ScrollerControl.ORIENTATION_VERT;else
this.m_ori=IDM.ScrollerControl.ORIENTATION_HORZ;this._rebuildItems();this._resize()},getSpeed:function(){return this.m_speed},setSpeed:function(speed){this.m_speed=Math.max(1,Math.min(30,speed))},getAutoScroll:function(){return this.m_autoScroll},setAutoScroll:function(autoScroll){this.m_autoScroll=(autoScroll?true:false)},addItem:function(item){this.m_items.add(item);this._rebuildItems()},_isInlineComponent:function(){return false},_create:function(contElt){HTMLUtils.addStyleClass(contElt,"idm-scroller-control");var leftElt=document.createElement("div");leftElt.className="prev";leftElt.onmouseover=JSUtils.makeCallbackEvent(this,IDM.ScrollerControl.prototype._onMouseOverArrow,"left");leftElt.onmouseout=JSUtils.makeCallbackEvent(this,IDM.ScrollerControl.prototype._onMouseOutArrow,"left");var leftOvyElt=document.createElement("div");leftOvyElt.className="prev-overlay";leftOvyElt.onmouseover=leftElt.onmouseover;leftOvyElt.onmouseout=leftElt.onmouseout;var bodyElt=document.createElement("div");bodyElt.style.position="relative";bodyElt.className="body";bodyElt.onmouseover=JSUtils.makeCallbackEvent(this,IDM.ScrollerControl.prototype._onMouseOverBody);bodyElt.onmouseout=JSUtils.makeCallbackEvent(this,IDM.ScrollerControl.prototype._onMouseOutBody);var bodyInnerElt=document.createElement("div");bodyInnerElt.className="body-inner";bodyInnerElt.style.position="absolute";bodyInnerElt.style.whiteSpace="nowrap";bodyInnerElt.style.left="0px";bodyInnerElt.style.top="0px";bodyElt.appendChild(bodyInnerElt);var rightElt=document.createElement("div");rightElt.className="next";rightElt.onmouseover=JSUtils.makeCallbackEvent(this,IDM.ScrollerControl.prototype._onMouseOverArrow,"right");rightElt.onmouseout=JSUtils.makeCallbackEvent(this,IDM.ScrollerControl.prototype._onMouseOutArrow,"right");var rightOvyElt=document.createElement("div");rightOvyElt.className="next-overlay";rightOvyElt.onmouseover=rightElt.onmouseover;rightOvyElt.onmouseout=rightElt.onmouseout;HTMLUtils.setElementSize(contElt,new Size(200,50));contElt.appendChild(leftElt);contElt.appendChild(bodyElt);contElt.appendChild(rightElt);contElt.appendChild(leftOvyElt);contElt.appendChild(rightOvyElt);this.m_contElt=NodeRef.create(contElt);this.m_leftElt=NodeRef.create(leftElt);this.m_leftOvyElt=NodeRef.create(leftOvyElt);this.m_bodyElt=NodeRef.create(bodyElt);this.m_bodyInnerElt=NodeRef.create(bodyInnerElt);this.m_rightElt=NodeRef.create(rightElt);this.m_rightOvyElt=NodeRef.create(rightOvyElt);this.m_animTimer=setInterval(JSUtils.makeCallback(this,IDM.ScrollerControl.prototype._animate),50);this._rebuildItems()},_rebuildItems:function(){if(!this.m_bodyInnerElt)
return;if(this.m_rebuildItemsTimeout){clearTimeout(this.m_rebuildItemsTimeout);this.m_rebuildItemsTimeout=null}
this.m_rebuildItemsTimeout=setTimeout
(JSUtils.makeCallback(this,IDM.ScrollerControl.prototype._rebuildItemsImpl),100)},_rebuildItemsImpl:function(){this.m_rebuildItemsTimeout=null;if(!this.m_bodyInnerElt)
return;var bodyInnerElt=this.m_bodyInnerElt.getElement();var oldBodyTableElt=this.m_bodyTableElt?this.m_bodyTableElt.getElement():null;var bodyTableElt=document.createElement("table");bodyTableElt.className="body-table";bodyTableElt.border=0;bodyTableElt.cellPadding=0;bodyTableElt.cellSpacing=0;if(this.m_ori==IDM.ScrollerControl.ORIENTATION_VERT){for(var i=0,n=this.m_items.getCount();i<n;++i){var item=this.m_items.getAt(i);var rowElt=bodyTableElt.insertRow(i);var cellElt=rowElt.insertCell(0);cellElt.appendChild(item.getHTMLElement())}}else
{var rowElt=bodyTableElt.insertRow(0);for(var i=0,n=this.m_items.getCount();i<n;++i){var item=this.m_items.getAt(i);var cellElt=rowElt.insertCell(i);cellElt.appendChild(item.getHTMLElement())}}
bodyInnerElt.appendChild(bodyTableElt);if(oldBodyTableElt)
oldBodyTableElt.parentNode.removeChild(oldBodyTableElt);this._updateScrollInfos()},_resize:function(){if(!this.m_contElt)
return;var contElt=this.m_contElt.getElement();HTMLUtils.removeStyleClass(contElt,"horz");HTMLUtils.removeStyleClass(contElt,"vert");if(this.m_ori==IDM.ScrollerControl.ORIENTATION_VERT)
HTMLUtils.addStyleClass(contElt,"vert");else
HTMLUtils.addStyleClass(contElt,"horz");JSUtils.invokeLater(JSUtils.makeCallback(this,IDM.ScrollerControl.prototype._resize2))},_resize2:function(){var contElt=this.m_contElt.getElement();var leftElt=this.m_leftElt.getElement();var leftOvyElt=this.m_leftOvyElt.getElement();var rightElt=this.m_rightElt.getElement();var rightOvyElt=this.m_rightOvyElt.getElement();var bodyElt=this.m_bodyElt.getElement();var bodyInnerElt=this.m_bodyInnerElt.getElement();var contSize=HTMLUtils.getElementSize(contElt);var leftSize=HTMLUtils.getElementSize(leftElt);var rightSize=HTMLUtils.getElementSize(rightElt);if(this.m_ori==IDM.ScrollerControl.ORIENTATION_VERT){leftElt.innerHTML="▲";rightElt.innerHTML="▼";leftElt.style.height=rightElt.style.height="";leftElt.style.lineHeight=rightElt.style.lineHeight="";leftOvyElt.style.height=rightOvyElt.style.height="";leftOvyElt.style.width=rightOvyElt.style.width=contSize.width+"px";leftOvyElt.style.left=leftOvyElt.style.top=rightOvyElt.style.left="0px";rightOvyElt.style.top=(contSize.height-HTMLUtils.getElementSize(rightOvyElt).height)+"px";bodyElt.style.width="";bodyElt.style.height=Math.max(0,contSize.height-leftSize.height-rightSize.height)+"px";bodyInnerElt.style.width=contSize.width+"px"}else
{leftElt.innerHTML="◀";rightElt.innerHTML="▶";leftElt.style.height=rightElt.style.height=contSize.height+"px";leftElt.style.lineHeight=rightElt.style.lineHeight=contSize.height+"px";leftOvyElt.style.width=rightOvyElt.style.width="";leftOvyElt.style.height=rightOvyElt.style.height=contSize.height+"px";leftOvyElt.style.left=leftOvyElt.style.top=rightOvyElt.style.top="0px";rightOvyElt.style.left=(contSize.width-HTMLUtils.getElementSize(rightOvyElt).width)+"px";bodyElt.style.width=Math.max(0,contSize.width-leftSize.width-rightSize.width)+"px";bodyElt.style.height=contSize.height+"px";bodyInnerElt.style.height=contSize.height+"px"}
this._updateScrollInfos()},_onMouseOverBody:function(ev){DOMEventUtils.stopPropagation(ev);this.m_overBody=true;return false},_onMouseOutBody:function(ev){DOMEventUtils.stopPropagation(ev);this.m_overBody=false;return false},_onMouseOverArrow:function(id,ev){DOMEventUtils.stopPropagation(ev);if(id=="left")
this.m_dir=1;else if(id=="right")
this.m_dir=-1;this.m_autoSwap=false;this.m_overArrow=true;if(this.m_autoScroll)
this.m_speedFactor=2.5;return false},_onMouseOutArrow:function(id,ev){DOMEventUtils.stopPropagation(ev);this.m_autoSwap=true;this.m_overArrow=false;this.m_speedFactor=1.0;return false},_updateScrollInfos:function(){var bodyElt=this.m_bodyElt.getElement();var bodySize=HTMLUtils.getElementSize(bodyElt);var bodyInnerElt=this.m_bodyInnerElt.getElement();var bodyInnerSize=HTMLUtils.getElementSize(bodyInnerElt);if(this.m_ori==IDM.ScrollerControl.ORIENTATION_VERT){this.m_scrollSize=bodyInnerSize.height;this.m_scrollContSize=bodySize.height}else
{this.m_scrollSize=bodyInnerSize.width;this.m_scrollContSize=bodySize.width}},_getScrollPos:function(){return this.m_scrollPos},_getScrollMin:function(){return 0},_getScrollMax:function(){return Math.max(0,this.m_scrollSize-this.m_scrollContSize)},_setScrollPos:function(pos){pos=Math.max(this._getScrollMin(),Math.min(this._getScrollMax(),Math.round(pos)));this.m_scrollPos=pos;var bodyInnerElt=this.m_bodyInnerElt.getElement();if(this.m_ori==IDM.ScrollerControl.ORIENTATION_VERT)
HTMLUtils.setElementPos(bodyInnerElt,new Point(0,-pos));else
HTMLUtils.setElementPos(bodyInnerElt,new Point(-pos,0))},_animate:function(){if((!this.m_autoScroll&&!this.m_overArrow)||this.m_overBody)
return;var pos=this._getScrollPos();var max=this._getScrollMax();var min=this._getScrollMin();var step=Math.round(this.m_speed*this.m_speedFactor);if(this.m_dir==1){pos-=step;if(pos<=min){pos=min;if(this.m_autoSwap)
this.m_dir=-1}}else
{pos+=step;if(pos>=max){pos=max;if(this.m_autoSwap)
this.m_dir=1}}
this._setScrollPos(pos)}}});IDM.ScrollerControl.Item=Class.define
({ctor:function(elt){this.m_elt=NodeRef.create(elt);IDM.Component._getComponentPoolElement().appendChild(elt)},prototype:{getHTMLElement:function(){return this.m_elt.getElement()}}});IDM.Effect={};IDM.Effect.Shadow=Class.define
({ctor:function(elt){this.m_elt=elt;this.m_temps=[]},prototype:{apply:function(){var size=this._getSize();var images=this._getImages();var eltSize=HTMLUtils.getElementSize(this.m_elt);var eltPos=HTMLUtils.getElementInnerPos(this.m_elt);var sw=size.width;var sh=size.height;var x=eltPos.x-sw/2;var y=eltPos.y-sh/2;var w=eltSize.width-sw;var h=eltSize.height-sh;var parentElt=this.m_elt.parentNode;var imgs=[];if(this.m_temps.length!=0){imgs=this.m_temps;HTMLUtils.moveElement(imgs[0],x,y,sw,sh);HTMLUtils.moveElement(imgs[1],x+sw,y,w,sh);HTMLUtils.moveElement(imgs[2],x+sw+w,y,sw,sh);HTMLUtils.moveElement(imgs[3],x+sw+w,y+sh,sw,h);HTMLUtils.moveElement(imgs[4],x+sw+w,y+sh+h,sw,sh);HTMLUtils.moveElement(imgs[5],x+sw,y+sh+h,w,sh);HTMLUtils.moveElement(imgs[6],x,y+sh+h,sw,sh);HTMLUtils.moveElement(imgs[7],x,y+sh,sw,h)}else
{imgs[0]=(images[0]?this._createImage(images[0],x,y,sw,sh):null);imgs[1]=(images[1]?this._createImage(images[1],x+sw,y,w,sh):null);imgs[2]=(images[2]?this._createImage(images[2],x+sw+w,y,sw,sh):null);imgs[3]=(images[3]?this._createImage(images[3],x+sw+w,y+sh,sw,h):null);imgs[4]=(images[4]?this._createImage(images[4],x+sw+w,y+sh+h,sw,sh):null);imgs[5]=(images[5]?this._createImage(images[5],x+sw,y+sh+h,w,sh):null);imgs[6]=(images[6]?this._createImage(images[6],x,y+sh+h,sw,sh):null);imgs[7]=(images[7]?this._createImage(images[7],x,y+sh,sw,h):null)}
for(var i=0,n=imgs.length;i<n;++i){if(imgs[i]!=null){var img=imgs[i];this.m_temps[i]=img;parentElt.insertBefore(img,this.m_elt);img.style.display="block";img.onclick=img.onmousedown=JSUtils.IGNORE_EVENT_FUNCTION}}},remove:function(){for(var i=0,n=this.m_temps.length;i<n;++i){var temp=this.m_temps[i];temp.style.display="none"}},destroy:function(){this._deleteTemps()},_deleteTemps:function(){for(var i=0,n=this.m_temps.length;i<n;++i){var temp=this.m_temps[i];temp.parentNode.removeChild(temp)}
this.m_temps=[]},_createImage:function(src,x,y,w,h){var img=document.createElement("img");img.style.left=Math.round(x)+"px";img.style.top=Math.round(y)+"px";img.style.width=Math.round(w)+"px";img.style.height=Math.round(h)+"px";img.style.position="absolute";img.style.visibility="visible";img.onclick=null;if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_IE){img.src="/styles/default/images/page/spacer.png";img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"
+src+"', sizingMethod='scale')"}else
{img.src=src}
return img}}});IDM.Effect.Shadow.Full=Class.define
({ctor:function(elt){IDM.Effect.Shadow.Full.baseConstructor.call(this,elt)},inherits:IDM.Effect.Shadow,prototype:{_getSize:function(){return new Size(30,30)},_getImages:function(){return['/styles/image.php?path=fw/boxshadow-nw.png','/styles/image.php?path=fw/boxshadow-n.png','/styles/image.php?path=fw/boxshadow-ne.png','/styles/image.php?path=fw/boxshadow-e.png','/styles/image.php?path=fw/boxshadow-se.png','/styles/image.php?path=fw/boxshadow-s.png','/styles/image.php?path=fw/boxshadow-sw.png','/styles/image.php?path=fw/boxshadow-w.png']}}});IDM.Animation={}
IDM.Animation.Animation=Class.define
({ctor:function(){IDM.Animation.Animation.baseConstructor.call(this);this.declareSlot("animation-started");this.declareSlot("animation-finished")},inherits:IDM.Object,prototype:{setup:function(){},start:function(){},_fireAnimationStarted:function(){this.getNamedSlot("animation-started").trigger()},_fireAnimationFinished:function(){this.getNamedSlot("animation-finished").trigger()}}});IDM.Animation.ProgressiveExpand=Class.define
({ctor:function(){IDM.Animation.ProgressiveExpand.baseConstructor.call(this);this.m_elt=null;this.m_height=0;this.m_stepSize=10;this.m_curHeight=0;this.m_animating=false;this.m_duration=100},inherits:IDM.Animation.Animation,prototype:{setup:function(elt){this.m_elt=NodeRef.create(elt);this.m_height=0;var childElts=HTMLUtils.getChildrenElements(elt);for(var i=0,n=childElts.length;i<n;++i){var childElt=childElts[i];var childSize=HTMLUtils.getElementSize(childElt);var childOuterSize=HTMLUtils.getElementOuterSize(childElt);var childMargins=HTMLUtils.getElementOuterMargins(childElt);this.m_height+=childOuterSize.height;if(i==0&&n!=1)
this.m_height-=childMargins.y1;if(i==n-1)
this.m_height-=childMargins.y2}
var size=HTMLUtils.getElementSize(elt);this.m_height=Math.max(size.height,this.m_height);this.m_stepSize=Math.max(1,this.m_height/10)},start:function(){if(this.m_animating)
return false;this.m_animating=true;this.m_curHeight=0;this._animate();this._fireAnimationStarted();return true},_animate:function(){var elt=this.m_elt.getElement();elt.style.height=Math.max(0,Math.floor(this.m_curHeight))+"px";if(!this._isFinished()){this._nextStep();var stepDuration=this.m_duration/this.m_stepSize;setTimeout(JSUtils.makeCallback(this,IDM.Animation.ProgressiveExpand.prototype._animate),stepDuration)}else
{this.m_animating=false;this._fireAnimationFinished()}},_nextStep:function(){this.m_curHeight=Math.min(this.m_height,this.m_curHeight+this.m_stepSize)},_isFinished:function(){return this.m_curHeight>=this.m_height}}});IDM.Animation.ProgressiveCollapse=Class.define
({ctor:function(){IDM.Animation.ProgressiveCollapse.baseConstructor.call(this)},inherits:IDM.Animation.ProgressiveExpand,prototype:{start:function(){if(this.m_animating)
return false;this.m_animating=true;this.m_curHeight=this.m_height;this._animate();this._fireAnimationStarted();return true},_nextStep:function(){this.m_curHeight=Math.max(0,this.m_curHeight-this.m_stepSize)},_isFinished:function(){return this.m_curHeight<=0}}});IDM.Animation.ProgressiveShow=Class.define
({ctor:function(){IDM.Animation.ProgressiveShow.baseConstructor.call(this);this.m_elt=null;this.m_curOpacity=0;this.m_step=10;this.m_animating=false;this.m_duration=400},inherits:IDM.Animation.Animation,prototype:{setup:function(elt){this.m_elt=NodeRef.create(elt)},start:function(){if(this.m_animating)
return false;this.m_curOpacity=0;this.m_animating=true;this._animate();this._fireAnimationStarted();return true},_animate:function(){var elt=this.m_elt.getElement();HTMLUtils.setElementOpacity(elt,this.m_curOpacity);if(!this._isFinished()){this._nextStep();var stepDuration=this.m_duration/this.m_step;setTimeout(JSUtils.makeCallback(this,IDM.Animation.ProgressiveShow.prototype._animate),stepDuration)}else
{this.m_animating=false;this._fireAnimationFinished()}},_nextStep:function(){this.m_curOpacity=Math.min(100,this.m_curOpacity+this.m_step)},_isFinished:function(){return this.m_curOpacity>=100}}});IDM.Animation.ProgressiveHide=Class.define
({ctor:function(){IDM.Animation.ProgressiveHide.baseConstructor.call(this)},inherits:IDM.Animation.ProgressiveShow,prototype:{start:function(){if(this.m_animating)
return false;this.m_curOpacity=100;this.m_animating=true;this._animate();this._fireAnimationStarted();return true},_nextStep:function(){this.m_curOpacity=Math.max(0,this.m_curOpacity-this.m_step)},_isFinished:function(){return this.m_curOpacity<=0}}});IDM.ImagePreloader=Class.define
({ctor:function(){this.m_contElt=null;this.m_images=new ArrayList();this.m_started=false},static:{s_instance:null,getInstance:function(){if(IDM.ImagePreloader.s_instance!=null)
return IDM.ImagePreloader.s_instance;return IDM.ImagePreloader.s_instance=new IDM.ImagePreloader()}},prototype:{addImages:function(urls){if(urls.m_isArrayList){for(var i=0,n=urls.getCount();i<n;++i)
this._addImageImpl(urls.getAt(i))}else
{for(var i=0,n=urls.length;i<n;++i)
this._addImageImpl(urls[i])}},addImage:function(url){this._addImageImpl(url)},_getContainer:function(){if(this.m_contElt==null){var contElt=document.createElement("div");contElt.style.position="absolute";HTMLUtils.setElementSize(contElt,new Size(1000,1000));HTMLUtils.setElementPos(contElt,new Point(-2000,-2000));document.body.appendChild(contElt);this.m_contElt=NodeRef.create(contElt)}
return this.m_contElt.getElement()},_addImageImpl:function(url){this.m_images.add(url);if(this.m_started)
this._loadImage(url)},_loadImage:function(url,contElt){if(!contElt)
contElt=this._getContainer();var imgElt=document.createElement("img");imgElt.src=url;contElt.appendChild(imgElt)},_init:function(){setTimeout(JSUtils.makeCallback(this,IDM.ImagePreloader.prototype._init2),3000)},_init2:function(){var dir='/styles/image.php?path=';var images=[];images[0]=dir+'fw/boxshadow-nw.png';images[1]=dir+'fw/boxshadow-n.png';images[2]=dir+'fw/boxshadow-ne.png';images[3]=dir+'fw/boxshadow-e.png';images[4]=dir+'fw/boxshadow-se.png';images[5]=dir+'fw/boxshadow-s.png';images[6]=dir+'fw/boxshadow-sw.png';images[7]=dir+'fw/boxshadow-w.png';images[8]=dir+'fw/helpbb-n.png';images[9]=dir+'fw/helpbb-s.png';images[10]=dir+'fw/helpbb-e.png';images[11]=dir+'fw/helpbb-w.png';images[12]=dir+'fw/helpbb-nw.png';images[13]=dir+'fw/helpbb-nwp.png';images[14]=dir+'fw/helpbb-ne.png';images[15]=dir+'fw/helpbb-nep.png';images[16]=dir+'fw/helpbb-se.png';images[17]=dir+'fw/helpbb-sep.png';images[18]=dir+'fw/helpbb-sw.png';images[19]=dir+'fw/helpbb-swp.png';images[20]=dir+'fw/colorpicker-satshade.png';images[21]=dir+'fw/colorpicker-dot.png';images[22]=dir+'fw/colorpicker-arrow.png';images[23]=dir+'fw/colorpicker-color.png';images[24]=dir+'fw/colorpicker-hueshade.png';images[25]=dir+'fw/colorpickerpal-color.png';images[26]=dir+'fw/colorpickerpal-color-sel.png';this.addImages(images);this._start()},_start:function(){var contElt=this._getContainer();this.m_started=true;for(var i=0,n=this.m_images.getCount();i<n;++i){var url=this.m_images.getAt(i);this._loadImage(url,contElt)}}}});HTMLUtils.addOnLoadFunction(JSUtils.makeCallback(IDM.ImagePreloader.getInstance(),IDM.ImagePreloader.prototype._init));IDM.Help={};IDM.Help.HelpDialog=Class.define
({ctor:function(mediaType,source,width,height,title){IDM.Help.HelpDialog.baseConstructor.call(this);this.setTitle(title?title:"Aide");this.setButtons([IDM.Dialog.Button.CLOSE]);this.m_mediaType=mediaType;this.m_source=source;this.m_width=width;this.m_height=height},inherits:IDM.Dialog,prototype:{_constructInner:function(contElt,boxElt){var sourceElt=document.createElement("div");boxElt.appendChild(sourceElt);var tmp=StringUtils.explode("/",this.m_mediaType);var type=tmp[0];var subType=(tmp.length>=2?tmp[1]:"");if(this.m_mediaType=="application/x-shockwave-flash"){sourceElt.innerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
+' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"'
+' width="'+this.m_width+'" height="'+this.m_height+'">'
+'<param name="movie" value="'+StringUtils.escapeXML(this.m_source)+'"/>'
+'<param name="quality" value="high">'
+'<embed src="'+StringUtils.escapeXML(this.m_source)+'" quality="high"'
+' pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"'
+' type="application/x-shockwave-flash" width="'+this.m_width+'" height="'+this.m_height+'"/>'
+'</embed>'
+'</object>'}else if(type=="image"){var imgElt=document.createElement("div");imgElt.className="preview-control";imgElt.style.width=this.m_width+"px";imgElt.style.height=this.m_height+"px";imgElt.style.backgroundImage="url("+this.m_source+")";imgElt.style.backgroundRepeat="no-repeat";imgElt.style.backgroundPosition="center center";sourceElt.appendChild(imgElt)}else if(this.m_mediaType=="text/html"){sourceElt.className="input-control";var ctsElt=document.createElement("div");ctsElt.style.width=(this.m_width==0?500:this.m_width)+"px";ctsElt.style.height=(this.m_height==0?350:this.m_height)+"px";sourceElt.appendChild(ctsElt);if(StringUtils.startsWith(this.m_source,"http://")||StringUtils.startsWith(this.m_source,"https://")||StringUtils.startsWith(this.m_source,"/")){var frameElt=document.createElement("iframe");ctsElt.appendChild(frameElt);frameElt.style.width=ctsElt.style.width;frameElt.style.height=ctsElt.style.height;frameElt.style.border="0px solid black";frameElt.frameBorder=false;frameElt.border=0;frameElt.src=this.m_source}else
{sourceElt.style.padding="10px";sourceElt.style.overflow="auto";ctsElt.innerHTML=this.m_source}}else
{HTMLUtils.setElementText(sourceElt,"Unsupported media type: '"+this.m_mediaType+"'.")}}}});HTTPRequestListener=Class.define
({prototype:{onHTTPResponse:function(responseText){},onHTTPError:function(responseText){},onHTTPStatusChanged:function(responseText){}}});HTTPRequest=Class.define
({ctor:function(url,listener){if(JSUtils.isString(url))
this.m_url=url;else
this.m_url=url.toString();this.m_http=HTTPRequest._getHTTPObject();this.m_listener=listener;this.m_body=null;this.m_method="GET";this.m_header=new Array()},static:{s_XMLHttpFactories:[function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],_getHTTPObject:function(){var xmlhttp=null;for(var i=0,n=HTTPRequest.s_XMLHttpFactories.length;i<n;++i){try{xmlhttp=HTTPRequest.s_XMLHttpFactories[i]()}
catch(e){continue}
break}
return xmlhttp}},prototype:{setListener:function(lst){this.m_listener=lst},setBody:function(body){this.m_body=body;this.m_method="POST";if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_SAFARI)
XMLUtils.getRootElement(body).setAttribute("safari-bug-18421","&")},setBodyParams:function(params){var body="";for(name in params){var value=params[name];if(body.length>0)
body+="&";body+=URL.escape(name)+"="+URL.escape(value)}
this.m_body=body;this.m_method="POST";this.m_header["Content-Type"]="application/x-www-form-urlencoded";this.m_header["Content-Length"]=body.length},_getURL:function(){var url=this.m_url;if(url.indexOf("?")!=-1)
url+="&rand="+Math.random();else
url+="?rand="+Math.random();return url},_setup:function(){},send:function(){this._setup();if(this.m_listener){var listener=this.m_listener;var http=this.m_http;http.onreadystatechange=function(){try
{if(http.readyState==4){if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_SAFARI){if(http.status==200||http.status==304){listener.onHTTPResponse(http.responseText)}else if(listener.onHTTPError){try
{listener.onHTTPError(http.responseText)}
catch(e){listener.onHTTPError(null)}}}else
{http.onreadystatechange=JSUtils.EMPTY_FUNCTION;if(/^(200|304)$/.test(http.status.toString())){listener.onHTTPResponse(http.responseText)}else if(listener.onHTTPError){try
{listener.onHTTPError(http.responseText)}
catch(e){listener.onHTTPError(null)}}}}else
{if(listener.onHTTPStatusChanged){try
{listener.onHTTPStatusChanged(http.responseText)}
catch(e){listener.onHTTPStatusChanged(null)}}}}
catch(e){listener.onHTTPError(null)}}}
try
{this.m_http.open(this.m_method,this._getURL(),true);for(p in this.m_header)
this.m_http.setRequestHeader(p,this.m_header[p]);this.m_http.send(this.m_body)}
catch(e){if(this.m_listener)
this.m_listener.onHTTPError(null)}},sendSync:function(){this._setup();try
{this.m_http.open(this.m_method,this._getURL(),false);for(p in this.m_header){try
{this.m_http.setRequestHeader(p,this.m_header[p])}
catch(e){if(JSUtils.isDebug())
alert("Invalid HTTPRequest header: '"+p+"' --> '"+this.m_header[p]+"'")}}
this.m_http.send(this.m_body)}
catch(e){return""}
return this.m_http.responseText}}});IDM.WebService=Class.define
({ctor:function(url,data){this.m_url=url;this.m_data=(data?data:null);this.m_result=null;this.m_error=null},prototype:{getURL:function(){return this.m_url},setData:function(data){this.m_data=data},getData:function(){return this.m_data},call:function(){var http=new HTTPRequest(this.m_url.toString());if(this.m_data)
http.setBody(this.m_data);var response=http.sendSync();return this._processResponse(response)},callAsync:function(callback){var lst=new HTTPRequestListener();var this_=this;lst.onHTTPResponse=function(response){this_._processResponse(response);if(callback)
callback()}
lst.onHTTPError=function(){this_._processResponse(null);if(callback)
callback()}
var http=new HTTPRequest(this.m_url.toString(),lst);if(this.m_data)
http.setBody(this.m_data);http.send();return true},isSuccess:function(){return this.m_result!=null&&this.m_error==null},isError:function(){return this.m_error!=null},getResult:function(){return this.m_result},getError:function(){return this.m_error},_processResponse:function(response){if(JSUtils.isDebug()){var responseExcerpt=(response==null?"(null)":response);if(responseExcerpt.length>2048)
responseExcerpt=responseExcerpt.substring(0,2048);IDM.Debug.Log.log(responseExcerpt,"WebService ["+this.m_url.toString()+"]")}
var result=(response==null?null:XMLUtils.createDocumentFromString(response));if(result!=null){this._processResult(result);return true}else
{this.m_error=new IDM.WebService.InternalError();return false}},_processResult:function(result){this.m_result=result;var rootElt=XMLUtils.getRootElement(result);if(rootElt!=null){if(rootElt.tagName=="error"){this.m_error=IDM.WebService.Error.createFromXML(rootElt)}else
{this.m_error=null}}}}});IDM.WebService.Error=Class.define
({ctor:function(){this.m_type="";this.m_code=0;this.m_message="";this.m_file="";this.m_line=0},static:{Code:{INVALID_ARGUMENT:1,UNEXPECTED_ERROR:2,OPERATION_NOT_ALLOWED:3,ACCESS_DENIED:4,INVALID_CREDENTIALS:5,ALREADY_EXISTS:6,FAILED:7,ILLEGAL_STATE:8,MISSING_ARGUMENT:9,NOT_FOUND:10,NOT_SIGNED_IN:11,INVALID_RANGE:12,INVALID_INPUT_DATA:13,ARGUMENT_REJECTED:14},createFromXML:function(node){var err=new IDM.WebService.Error();err.m_type=XMLUtils.getChildText(node,"type");err.m_code=parseInt(XMLUtils.getChildText(node,"code"));err.m_message=XMLUtils.getChildText(node,"message");err.m_file=XMLUtils.getChildText(node,"file");err.m_line=parseInt(XMLUtils.getChildText(node,"line"));return err}},prototype:{getType:function(){return this.m_type},getCode:function(){return this.m_code},getMessage:function(){return this.m_message},getFile:function(){return this.m_file},getLine:function(){return this.m_line},toString:function(){var res="WebService Error:\n\n";res+="Type: "+this.getType()+"\n";res+="Code: "+this.getCode()+"\n";res+="File: "+this.getFile()+":"+this.getLine()+"\n";res+="\n";res+=this.getMessage();return res}}});IDM.WebService.InternalError=Class.define
({ctor:function(){IDM.WebService.Error.call(this)},inherits:IDM.WebService.Error,prototype:{getType:function(){return"INTERNAL_ERROR"},getCode:function(){return 0},getMessage:function(){return"Internal error."},getFile:function(){return"webservice.js"},getLine:function(){return 0}}});function ImageNotification(){}
ImageNotification.Do=function(obj,beforeAction,action,afterAction){if(beforeAction)
beforeAction();obj.onload=function(){obj.onload=null;obj.onreadystatechange=null;afterAction()}
obj.onreadystatechange=function(){if(obj.readystate==4||obj.readystate==="complete"){obj.onload=null;obj.onreadystatechange=null;afterAction()}}
action()}
var Drag={obj:null,fini:function(o){o.onmousedown=null},init:function(o,oRoot,minX,maxX,minY,maxY,bSwapHorzRef,bSwapVertRef,fXMapper,fYMapper){o.onmousedown=Drag.start;o.hmode=bSwapHorzRef?false:true;o.vmode=bSwapVertRef?false:true;o.root=oRoot&&oRoot!=null?oRoot:o;if(o.hmode&&isNaN(parseInt(o.root.style.left)))o.root.style.left="0px";if(o.vmode&&isNaN(parseInt(o.root.style.top)))o.root.style.top="0px";if(!o.hmode&&isNaN(parseInt(o.root.style.right)))o.root.style.right="0px";if(!o.vmode&&isNaN(parseInt(o.root.style.bottom)))o.root.style.bottom="0px";o.minX=typeof minX!='undefined'?minX:null;o.minY=typeof minY!='undefined'?minY:null;o.maxX=typeof maxX!='undefined'?maxX:null;o.maxY=typeof maxY!='undefined'?maxY:null;o.xMapper=fXMapper?fXMapper:null;o.yMapper=fYMapper?fYMapper:null;o.root.getDragStartThreshold=function(){return 5}
o.root.onDragPrepare=new Function();o.root.onDragStart=new Function();o.root.onDragEnd=new Function();o.root.onDrag=new Function()},start:function(e){var o=Drag.obj=this;e=Drag.fixE(e);var y=parseInt(o.vmode?o.root.style.top:o.root.style.bottom);var x=parseInt(o.hmode?o.root.style.left:o.root.style.right);o.root.onDragPrepare(x,y);DOMEventUtils.stopPropagation(e);o.firstMouseX=e.clientX;o.firstMouseY=e.clientY;o.lastMouseX=e.clientX;o.lastMouseY=e.clientY;o.started=false;if(o.hmode){if(o.minX!=null)o.minMouseX=e.clientX-x+o.minX;if(o.maxX!=null)o.maxMouseX=o.minMouseX+o.maxX-o.minX}else{if(o.minX!=null)o.maxMouseX=-o.minX+e.clientX+x;if(o.maxX!=null)o.minMouseX=-o.maxX+e.clientX+x}
if(o.vmode){if(o.minY!=null)o.minMouseY=e.clientY-y+o.minY;if(o.maxY!=null)o.maxMouseY=o.minMouseY+o.maxY-o.minY}else{if(o.minY!=null)o.maxMouseY=-o.minY+e.clientY+y;if(o.maxY!=null)o.minMouseY=-o.maxY+e.clientY+y}
o.root["__top"]=o.root.style.top;o.root["__bottom"]=o.root.style.bottom;o.root["__left"]=o.root.style.left;o.root["__right"]=o.root.style.right;document.onmousemove=Drag.drag;document.onmouseup=Drag.end;return false},drag:function(e){var ev=DOMEventUtils.getEvent(e);var mpos=DOMEventUtils.getMousePos(ev);var mx=mpos.x,my=mpos.y;e=Drag.fixE(e);var o=Drag.obj;DOMEventUtils.stopPropagation(e);var ey=e.clientY;var ex=e.clientX;var threshold=o.root.getDragStartThreshold();if(!o.started&&(Math.abs(ex-o.firstMouseX)>=threshold||Math.abs(ey-o.firstMouseY)>=threshold)){if(!o.root.onDragStart(ex,ey)){document.onmousemove=null;document.onmouseup=null;return false}
o.started=true}
var y=parseInt(o.vmode?o.root["__top"]:o.root["__bottom"]);var x=parseInt(o.hmode?o.root["__left"]:o.root["__right"]);var nx,ny;if(o.minX!=null)ex=o.hmode?Math.max(ex,o.minMouseX):Math.min(ex,o.maxMouseX);if(o.maxX!=null)ex=o.hmode?Math.min(ex,o.maxMouseX):Math.max(ex,o.minMouseX);if(o.minY!=null)ey=o.vmode?Math.max(ey,o.minMouseY):Math.min(ey,o.maxMouseY);if(o.maxY!=null)ey=o.vmode?Math.min(ey,o.maxMouseY):Math.max(ey,o.minMouseY);nx=x+((ex-o.lastMouseX)*(o.hmode?1:-1));ny=y+((ey-o.lastMouseY)*(o.vmode?1:-1));if(o.xMapper)nx=o.xMapper(y)
else if(o.yMapper)ny=o.yMapper(x)
Drag.obj.root[o.hmode?"__left":"__right"]=nx+"px";Drag.obj.root[o.vmode?"__top":"__bottom"]=ny+"px";Drag.obj.lastMouseX=ex;Drag.obj.lastMouseY=ey;if(o.started)
Drag.obj.root.onDrag(nx,ny,mx,my,e);return false},end:function(e){var ev=DOMEventUtils.getEvent(e);var mpos=DOMEventUtils.getMousePos(ev);var mx=mpos.x,my=mpos.y;DOMEventUtils.stopPropagation(e);document.onmousemove=null;document.onmouseup=null;var o=Drag.obj;var y=parseInt(o.vmode?o.root["__top"]:o.root["__bottom"]);var x=parseInt(o.hmode?o.root["__left"]:o.root["__right"]);if(o.started)
o.onDragEnd(x,y,mx,my,Drag.fixE(e));Drag.obj=null;return false},fixE:function(e){if(typeof e=='undefined')e=window.event;if(typeof e.layerX=='undefined')e.layerX=e.offsetX;if(typeof e.layerY=='undefined')e.layerY=e.offsetY;return e}};ImageDragger=Class.define
({ctor:function(){this.m_targets=new Array();this.m_border=false;this.m_dropCallback=function(sourceObj,sourceId,targetObj,targetId){alert("Not implemented!")}
this.m_dropCallbacks=new Array();this.m_dragStartCallback=new Array();this.m_dragEndCallback=new Array();this.m_dragCallbacks=new Array();this.m_dragPrepareElementCallback=null;this.m_multiHit=false},prototype:{setBorder:function(border){this.m_border=(border?true:false)},setMultiHit:function(multiHit){this.m_multiHit=(multiHit?true:false)},setDragPrepareElementCallback:function(callback){this.m_dragPrepareElementCallback=callback},setDropCallback:function(callback){this.m_dropCallback=callback},addDropCallback:function(callbackId,callback){this.m_dropCallbacks[this.m_dropCallbacks.length]=Array(callbackId,callback)},removeDropCallback:function(callbackId){var callbacks=new Array();for(var i=0;i<this.m_dropCallbacks.length;++i){if(this.m_dropCallbacks[i][0]!=callbackId)
callbacks[callbacks.length]=this.m_dropCallbacks[i]}
this.m_dropCallbacks=callbacks},addDragStartCallback:function(callback){this.m_dragStartCallback[this.m_dragStartCallback.length]=callback},addDragEndCallback:function(callback){this.m_dragEndCallback[this.m_dragEndCallback.length]=callback},addDragCallback:function(callback){this.m_dragCallbacks[this.m_dragCallbacks.length]=callback},removeDragCallback:function(callback){var callbacks=new Array();for(var i=0;i<this.m_dragCallbacks.length;++i){if(this.m_dragCallbacks[i][0]!=callback)
callbacks[callbacks.length]=this.m_dragCallbacks[i]}
this.m_dragCallbacks=callbacks},registerTarget:function(targetObj,targetId,pointerDrop){this.m_targets[this.m_targets.length]=Array(targetObj,targetId,pointerDrop)},unregisterTarget:function(targetObjOrId){var targets=new Array();for(var i=0;i<this.m_targets.length;++i){if(this.m_targets[i][0]!=targetObjOrId&&this.m_targets[i][1]!=targetObjOrId)
targets[targets.length]=this.m_targets[i]}
this.m_targets=targets},unregisterAllTargets:function(){this.m_targets=[]},unregisterSource:function(sourceObj){Drag.fini(sourceObj);sourceObj.onDragPrepare=null;sourceObj.onDragStart=null;sourceObj.onDrag=null;sourceObj.onDragEnd=null;sourceObj.m_imageDragger=null},registerSource:function(sourceObj,sourceId){Drag.init(sourceObj,null,null,null,null,null);sourceObj.onDragPrepare=ImageDragger.onDragPrepare;sourceObj.onDragStart=ImageDragger.onDragStart;sourceObj.onDrag=ImageDragger.onDrag;sourceObj.onDragEnd=ImageDragger.onDragEnd;sourceObj.m_dragId=sourceId;sourceObj.m_imageDragger=this}},static:{onDragPrepare:function(){for(var i=0;i<this.m_imageDragger.m_dragStartCallback.length;++i)
this.m_imageDragger.m_dragStartCallback[i]()},onDragStart:function(x,y){var div=document.createElement("div");div.style.position="absolute";div.style.visibility="hidden";div.style.left="-500px";div.style.top="-500px";div.style.overflow="visible";this.m_pos=HTMLUtils.getElementPos(this);this.m_firstMove=true;if(this.m_imageDragger.m_dragPrepareElementCallback){var elt=this.m_imageDragger.m_dragPrepareElementCallback
(this,this.m_dragId,x-this.m_pos.x,y-this.m_pos.y);if(elt==null)
return false;div.appendChild(elt)}else
{var img=this.cloneNode(true);img.id="";div.appendChild(img);img.style.padding="0px";img.style.margin="0px";img.style.position="relative";img.style.border="0";img.style.left="0px";img.style.top="0px";img.onmousedown=null;img.onmouseover=null;img.onDragStart=null;img.onDrag=null;img.onDragEnd=null;if(img.width&&img.height){div.style.width=img.width+"px";div.style.height=img.height+"px"}else
{var size=HTMLUtils.getElementSize(img);div.style.width=size.width+"px";div.style.height=size.height+"px"}
if(this.m_border){div.style.backgroundColor="#ffffff";div.style.padding="4px";div.style.border="1px solid #808080"}}
this.m_div=div;document.body.appendChild(div);if(!this.m_offsetX)this.m_offsetX=0;if(!this.m_offsetY)this.m_offsetY=0;for(var i=0;i<this.m_imageDragger.m_dragStartCallback.length;++i)
this.m_imageDragger.m_dragStartCallback[i]();return true},onDrag:function(x,y,mouseX,mouseY,ev){if(this.m_firstMove){this.m_firstMove=false;this.m_offsetX=x;this.m_offsetY=y}
this.m_div.style.left=(x+this.m_pos.x-this.m_offsetX)+"px";this.m_div.style.top=(y+this.m_pos.y-this.m_offsetY)+"px";this.m_div.style.visibility="visible";for(var i=0,n=this.m_imageDragger.m_dragCallbacks.length;i<n;++i)
this.m_imageDragger.m_dragCallbacks[i](ev)},onDragEnd:function(x,y,mouseX,mouseY,ev){var imageDragger=this.m_imageDragger;try{document.body.removeChild(this.m_div)}
catch(e){}
try{if(this.m_div.parentNode){this.m_div.parentNode.removeChild(this.m_div)}}
catch(e){}
this.m_div=null;x+=this.m_pos.x-this.m_offsetX;y+=this.m_pos.y-this.m_offsetY;this.m_offsetX=x;this.m_offsetY=y;var w=parseInt(this.offsetWidth);var h=parseInt(this.offsetHeight);var targetPos=[];var targetSize=[];for(var i=imageDragger.m_targets.length-1;i>=0;--i){var target=imageDragger.m_targets[i][0];if(target==null)
continue;var pos=HTMLUtils.getElementPos(target);var size=HTMLUtils.getElementSize(target);targetPos[i]=pos;targetSize[i]=size}
for(var i=0;i<this.m_imageDragger.m_dragEndCallback.length;++i)
this.m_imageDragger.m_dragEndCallback[i]();for(var i=imageDragger.m_targets.length-1;i>=0;--i){var target=imageDragger.m_targets[i][0];var targetId=imageDragger.m_targets[i][1];var pointerDrop=imageDragger.m_targets[i][2];if(target==null)
continue;var pos=targetPos[i];var size=targetSize[i];var hit=false;if(pointerDrop){hit=(mouseX>=pos.x&&mouseX<=pos.x+size.width&&mouseY>=pos.y&&mouseY<=pos.y+size.height)}else
{hit=(x+w>=pos.x&&x<pos.x+target.offsetWidth&&y+h>=pos.y&&y<pos.y+target.offsetHeight)}
if(hit){var stop=false;for(var j=0,p=imageDragger.m_dropCallbacks.length;!stop&&j<p;++j){stop=imageDragger.m_dropCallbacks[j][1](this,this.m_dragId,target,targetId,mouseX,mouseY,ev)}
if(!stop&&imageDragger.m_dropCallback){stop=imageDragger.m_dropCallback(this,this.m_dragId,target,targetId,mouseX,mouseY,ev)}
if(stop||!imageDragger.m_multiHit)
return}}}}});var gBackgroundLayers=new Array();var gBackgroundLayerCount=0;function stackBackgroundLayer(){var div=document.createElement("div");div.className="bkgnd-layer idm-background-layer";div.style.position="absolute";div.style.left="0px";div.style.top="0px";div.onmousedown=JSUtils.IGNORE_EVENT_FUNCTION;div.onmousemove=JSUtils.IGNORE_EVENT_FUNCTION;div.onclick=JSUtils.IGNORE_EVENT_FUNCTION;var bodySize=HTMLUtils.getDocumentSize();div.style.width=bodySize.width+"px";div.style.height=bodySize.height+"px";document.body.appendChild(div);if(gBackgroundLayerCount!=0)
gBackgroundLayers[gBackgroundLayerCount-1].getElement().style.visibility="hidden";gBackgroundLayers[gBackgroundLayerCount]=NodeRef.create(div);gBackgroundLayerCount++}
function unstackBackgroundLayer(){if(gBackgroundLayerCount<1)
return;var div=gBackgroundLayers[gBackgroundLayerCount-1].getElement();gBackgroundLayers[gBackgroundLayerCount-1]=null;gBackgroundLayerCount--;if(gBackgroundLayerCount!=0)
gBackgroundLayers[gBackgroundLayerCount-1].getElement().style.visibility="";div.parentNode.removeChild(div)}
function DialogButton(id,text,cancel){this.m_id=id;this.m_text=text;this.m_cancel=(cancel==window.undefined?false:(cancel?true:false))}
DialogButton.prototype.getId=function(){return this.m_id}
DialogButton.prototype.getText=function(){return this.m_text}
DialogButton.prototype.isCancelButton=function(){return this.m_cancel}
DialogButton.prototype.createElement=function(){var btn=document.createElement("button");var space=String.fromCharCode(160);var text=this.m_text;while(text.length<13)
text=space+text+space;btn.className="button IDM_NoReflect";btn.appendChild(document.createTextNode(space+text+space));btn.m_button=this;return btn}
DialogButton.NONE=null;DialogButton.OK=new DialogButton(-1,"OK");DialogButton.CANCEL=new DialogButton(-2,"Annuler",true);DialogButton.YES=new DialogButton(-3,"Oui");DialogButton.NO=new DialogButton(-4,"Non",true);DialogButton.RETRY=new DialogButton(-5,"Réessayer");DialogButton.ABORT=new DialogButton(-6,"Abandonner",true);DialogButton.APPLY=new DialogButton(-7,"Appliquer");DialogButton.CLOSE=new DialogButton(-8,"Fermer",true);DialogButton.NEXT=new DialogButton(-9,"Suivant >");DialogButton.PREV=new DialogButton(-10,"< Précédent");DialogButton.FINISH=new DialogButton(-11,"Terminer");function Dialog(){this.Dialog__m_title="Message";this.Dialog__m_buttons=new Array();this.Dialog__m_callback=null;this.Dialog__m_callbackParam=null;this.Dialog__m_result=null;this.Dialog__m_frame=null;this.Dialog__m_buttonBar=null;this.Dialog__m_titleBar=null;this.Dialog__m_closeButton=null;this.Dialog__m_box=null;this.Dialog__m_moved=false;this.Dialog__m_oldDocKeyDown=null;this.Dialog__m_oldDocKeyUp=null;this.Dialog__m_oldDocKeyPress=null;this.Dialog__m_padding=[10,10,10,10];this.Dialog__m_backColor=null;this.Dialog__m_buttonsElt=new Array()}
Dialog.prototype.setBackgroundColor=function(c){this.Dialog__m_backColor=c}
Dialog.prototype.setCallback=function(callback,param){this.Dialog__m_callback=callback;this.Dialog__m_callbackParam=param}
Dialog.prototype.setButtons=function(btnArray){this.Dialog__m_buttons=btnArray}
Dialog.prototype.addButton=function(btn){this.Dialog__m_buttons[this.Dialog__m_buttons.length]=btn}
Dialog.prototype.getResult=function(){return this.Dialog__m_result}
Dialog.prototype.getSize=function(){return null}
Dialog.prototype.construct=function(box){}
Dialog.prototype.init=function(){}
Dialog.prototype.getTitle=function(){return m_title}
Dialog.prototype.setTitle=function(title){this.Dialog__m_title=title}
Dialog.prototype.adjustInnerFrame=function(size){var res=size.clone();res.width+=this.Dialog__m_padding[1]+this.Dialog__m_padding[3];res.height+=25+this.Dialog__m_padding[0]+this.Dialog__m_padding[2]+this._getButtonBarHeight();return res}
Dialog.prototype._getButtonBarHeight=function(){return this.Dialog__m_buttons.length!=0?35:0}
Dialog.prototype.show=function(){this.Dialog__m_oldDocKeyDown=document.onkeydown;document.onkeydown=null;this.Dialog__m_oldDocKeyUp=document.onkeyup;document.onkeyup=null;this.Dialog__m_oldDocKeyPress=document.onkeypress;document.onkeypress=null;var space=String.fromCharCode(160);var frame=document.createElement("div");var box=document.createElement("div");frame.className="dialog-frame";frame.style.position="absolute";frame.style.left="-10000px";frame.style.top="-10000px";this.Dialog__m_box=NodeRef.create(box);if(this.Dialog__m_backColor!=null)
frame.style.backgroundColor=this.Dialog__m_backColor.toHex();document.body.appendChild(frame);frame.appendChild(box);this.Dialog__m_frame=NodeRef.create(frame);this.construct(box);Dialog._showSelects(frame,false);var size=this.getSize();box.style.position="absolute";box.style.left="10px";box.style.top=(25+this.Dialog__m_padding[0])+"px";box.style.width=size.width+"px";box.style.height=size.height+"px";size=this.adjustInnerFrame(size);frame.style.position="absolute";frame.style.width=size.width+"px";frame.style.height=size.height+"px";var buttonBar=document.createElement("div");var hasCancelButton=false;buttonBar.className="button-bar";buttonBar.style.position="absolute";buttonBar.style.width=size.width+"px";buttonBar.style.left="0px";buttonBar.style.top=(parseInt(box.style.top)+parseInt(box.style.height)+this.Dialog__m_padding[2])+"px";var btns=this.Dialog__m_buttons;var btns2=new Array();var btnsElt=new Array();for(var i=0;i<btns.length;++i){var btn=btns[i];if(btn==null)
continue;var elt=btn.createElement();buttonBar.appendChild(elt);buttonBar.appendChild(document.createTextNode(" "));if(btn.isCancelButton())
hasCancelButton=true;elt.m_button=btn;elt.m_dialog=this;elt.onclick=Dialog._onClickButtonWrapper;btns2[btns2.length]=btn;btnsElt[btnsElt.length]=NodeRef.create(elt)}
this.Dialog__m_buttons=btns2;this.Dialog__m_buttonsElt=btnsElt;frame.appendChild(buttonBar);this.Dialog__m_buttonBar=NodeRef.create(buttonBar);if(this.Dialog__m_buttons.length==1)
hasCancelButton=true;var titleBar=document.createElement("div");frame.appendChild(titleBar);titleBar.className="title-bar";titleBar.style.position="absolute";titleBar.style.left="0px";titleBar.style.top="0px";titleBar.style.width=size.width+"px";titleBar.appendChild(document.createTextNode(space+space+this.Dialog__m_title));titleBar.m_dialog=this;Drag.init(titleBar,null);titleBar.onDragStart=Dialog._onTitleBarDragStart;titleBar.onDrag=Dialog._onTitleBarDrag;var closeButton=document.createElement("div");titleBar.appendChild(closeButton);closeButton.className="close-button";closeButton.style.left=(size.width-20)+"px";closeButton.m_dialog=this;if(hasCancelButton){closeButton.style.cursor="pointer";closeButton.onclick=Dialog._onClickCloseButton;closeButton.title=closeButton.alt="Annuler et fermer la fenêtre"}else
{HTMLUtils.setElementOpacity(closeButton,55)}
this.Dialog__m_titleBar=NodeRef.create(titleBar);this.Dialog__m_closeButton=NodeRef.create(closeButton);var bodySize=HTMLUtils.getWindowInnerSize();frame.style.left=((bodySize.width-size.width)/2)+"px";frame.style.top=(HTMLUtils.getScrollPos().y+((bodySize.height-size.height)/2))+"px";this.init();stackBackgroundLayer();document.body.removeChild(frame);document.body.appendChild(frame);frame.style.visibility="";this.onAfterShow();return true}
Dialog.prototype.setSize=function(size){var frame=this.Dialog__m_frame.getElement();var frameSize=this.adjustInnerFrame(size);HTMLUtils.setElementSize(frame,frameSize);var box=this.Dialog__m_box.getElement();if(this.Dialog__m_buttonBar){var buttonBar=this.Dialog__m_buttonBar.getElement();buttonBar.style.top=(HTMLUtils.getElementSize(frame).height-HTMLUtils.getElementSize(buttonBar).height-5)+"px"}}
Dialog._onTitleBarDragStart=function(x,y){this.m_start=true}
Dialog._onTitleBarDrag=function(x,y,mx,my){var dialog=this.m_dialog;var frame=dialog.Dialog__m_frame.getElement();if(this.m_start){var pos=HTMLUtils.getElementPos(frame);this.m_startX=pos.x;this.m_startY=pos.y;this.m_startMX=mx;this.m_startMY=my;this.m_start=false;dialog.Dialog__m_moved=true}
x=Math.max(0,(this.m_startX+mx-this.m_startMX));y=Math.max(0,(this.m_startY+my-this.m_startMY));frame.style.left=x+"px";frame.style.top=y+"px"}
Dialog._onClickCloseButton=function(){var dialog=this.m_dialog;var buttons=dialog.Dialog__m_buttons;for(var i=0;i<buttons.length;++i){if(buttons[i]!=null&&(buttons[i].isCancelButton()||buttons.length==1)){dialog._onClickButton(buttons[i]);break}}}
Dialog._onClickButtonWrapper=function(){this.m_dialog._onClickButton(this.m_button)}
Dialog.prototype._onClickButton=function(button){if(!this.onButtonClicked(button))
return;this.hide();this.Dialog__m_result=button;if(this.Dialog__m_callback)
this.Dialog__m_callback(this.Dialog__m_callbackParam,this);this.close()}
Dialog.prototype._getButtonEltById=function(id){for(var i=0,n=this.Dialog__m_buttonsElt.length;i<n;++i){var elt=this.Dialog__m_buttonsElt[i].getElement();var btn=elt.m_button;if(btn.getId()==id)
return elt}
return null}
Dialog.prototype.showButtonById=function(id,show){var elt=this._getButtonEltById(id);if(show==window.undefined)
show=true;if(elt!=null)
elt.style.display=(show?"":"none")}
Dialog.prototype.hideButtonById=function(id){this.showButtonById(id,false)}
Dialog.prototype.enableButtonById=function(id,enable){var elt=this._getButtonEltById(id);if(enable==window.undefined)
enable=true;if(elt!=null){elt.disabled=!enable;if(enable)
HTMLUtils.removeStyleClass(elt,"disabled");else
HTMLUtils.addStyleClass(elt,"disabled")}}
Dialog.prototype.hide=function(){this.Dialog__m_frame.getElement().style.visibility="hidden"}
Dialog.prototype.close=function(){unstackBackgroundLayer();var frame=this.Dialog__m_frame.getElement();frame.parentNode.removeChild(frame);this.Dialog__m_frame=null;Dialog._showSelects(frame,true);if(this.Dialog__m_oldDocKeyDown)document.onkeydown=this.Dialog__m_oldDocKeyDown;if(this.Dialog__m_oldDocKeyUp)document.onkeyup=this.Dialog__m_oldDocKeyUp;if(this.Dialog__m_oldDocKeyPress)document.onkeypress=this.Dialog__m_oldDocKeyPress}
Dialog.prototype.enableButton=function(button,enable){this.enableButtonById(button.getId(),enable)}
Dialog.prototype.onButtonClicked=function(button){return true}
Dialog.prototype.onAfterShow=function(){}
Dialog._showSelects=function(frame,show){if(window.ActiveXObject){var elts=document.getElementsByTagName("select");for(var i=0;i<elts.length;++i){var elt=elts[i];if(HTMLUtils.hasParent(elt,frame))
continue;if(!elt.m_visibleCounter)
elt.m_visibleCounter=(elt.style.visibility=="hidden"?-1:0);if(show){if(++elt.m_visibleCounter>=0)
elt.style.visibility=""}else
{elt.m_visibleCounter--;elt.style.visibility="hidden"}}}}
function MessageDialog(message,type,buttons,title){this.m_message=message.replace(/\n/g,"<br/>");this.m_options=new Array();this.m_optionsTag=new Array();this.m_selOption=-1;this.m_icon=null;this.m_prompt=null;this.m_promptText="";if(type)
this.m_type=type;else
this.m_type=MessageDialog.TYPE_WARNING;if(buttons)
this.setButtons(buttons);else
this.setButtons([DialogButton.OK]);if(title){this.setTitle(title)}else
{switch(this.m_type){case MessageDialog.TYPE_WARNING:this.setTitle("Avertissement");break;case MessageDialog.TYPE_ERROR:this.setTitle("Erreur");break;case MessageDialog.TYPE_INFO:this.setTitle("Information");break;case MessageDialog.TYPE_QUESTION:this.setTitle("Question");break}}
this.m_size=new Size();this.m_input=null;this.m_ext=null}
MessageDialog.TYPE_WARNING="warning";MessageDialog.TYPE_ERROR="error";MessageDialog.TYPE_INFO="info";MessageDialog.TYPE_QUESTION="question";MessageDialog.TYPE_INFORMATION=MessageDialog.TYPE_INFO;MessageDialog.prototype=new Dialog();MessageDialog.prototype.setIcon=function(url){this.m_icon=url}
MessageDialog.prototype.setExtension=function(ext){this.m_ext=ext}
MessageDialog.prototype.addOption=function(text,tag){this.m_options[this.m_options.length]=text;this.m_optionsTag[this.m_optionsTag.length]=tag;this.m_selOption=0}
MessageDialog.prototype.setSelectedOption=function(index){if(index>=0&&index<this.m_options.length)
this.m_selOption=index}
MessageDialog.prototype.getSelectedOption=function(){return this.m_selOption}
MessageDialog.prototype.getSelectedOptionTag=function(){return this.m_optionsTag[this.m_selOption]}
MessageDialog.prototype.setPrompt=function(prompt){this.m_prompt=prompt}
MessageDialog.prototype.setPromptText=function(text){this.m_promptText=text}
MessageDialog.prototype.getPromptText=function(){return this.m_promptText}
MessageDialog.prototype.getSize=function(){return this.m_size}
MessageDialog.sOptGroupCounter=0;MessageDialog.prototype.construct=function(box){var minWidth=300;var maxWidth=500;var minHeight=80;var icon=document.createElement("div");icon.style.position="absolute";icon.style.width="80px";icon.style.height=minHeight+"px";icon.style.backgroundPosition="5px center";icon.style.backgroundRepeat="no-repeat";if(this.m_icon!=null)
icon.style.backgroundImage="url("+this.m_icon+")";else
icon.style.backgroundImage="url(/styles/image.php?path=fw/msgdlg-"+this.m_type+".png)";var iconSize=new Size(80,minHeight);box.appendChild(icon);var text=document.createElement("div");box.appendChild(text);var textSize=HTMLUtils.computeTextSize(this.m_message,maxWidth,text);textSize.height+=5;HTMLUtils.setInnerHTML(text,this.m_message);text.style.position="absolute";text.style.left="80px";text.style.width=textSize.width+"px";text.style.height=textSize.height+"px";text.style.overflow="hidden";var optionsSize=new Size();var top=HTMLUtils.getElementSize(text).height
if(this.m_options.length!=0){var options=document.createElement("div");options.style.position="absolute";options.style.left=text.style.left;options.style.top=(top+15)+"px";options.style.width=text.style.width;box.appendChild(options);for(var i=0;i<this.m_options.length;++i){var optText=this.m_options[i];var opt=document.createElement("input");opt.type="radio";opt.defaultChecked=opt.checked=(this.m_selOption==i?"checked":"");opt.style.cursor="pointer";opt.name="msgdlg-optgroup"+MessageDialog.sOptGroupCounter;opt.m_dialog=this;opt.m_index=i;opt.onclick=MessageDialog._onClickedOption;options.appendChild(opt);options.appendChild(document.createTextNode(optText));options.appendChild(document.createElement("br"))}
optionsSize.height=HTMLUtils.getElementSize(options).height;top+=15+optionsSize.height}
var promptSize=new Size();if(this.m_prompt!=null){var prompt=document.createElement("div");prompt.style.position="absolute";prompt.style.left=text.style.left;prompt.style.top=(top+15)+"px";prompt.style.width=text.style.width;box.appendChild(prompt);HTMLUtils.setInnerHTML(prompt,this.m_prompt);prompt.appendChild(document.createElement("br"));var input=document.createElement("input");input.className="textbox";input.value=this.m_promptText;input.m_dialog=this;input.style.width=text.style.width;input.onchange=MessageDialog._onChangedPrompt;prompt.appendChild(input);this.m_input=NodeRef.create(input);promptSize.height=HTMLUtils.getElementSize(prompt).height;top+=15+promptSize.height}
var extSize=new Size();if(this.m_ext!=null){if(this.m_ext.getHTMLElement){box.appendChild(this.m_ext.getHTMLElement());this.m_ext.pack();HTMLUtils.setElementPos(this.m_ext.getHTMLElement(),new Point(parseInt(text.style.left),top+15));extSize=HTMLUtils.getElementSize(this.m_ext.getHTMLElement())}else
{box.appendChild(this.m_ext);HTMLUtils.setElementPos(this.m_ext,new Point(parseInt(text.style.left),top+15));extSize=HTMLUtils.getElementSize(this.m_ext);this.m_ext.style.position="absolute";this.m_ext=null}
top+=15+extSize.height}
this.m_size.width=iconSize.width+Math.max(Math.max(Math.max(textSize.width,optionsSize.width),promptSize.width),extSize.width)+25;this.m_size.height=(top<minHeight?minHeight:top+15);icon.style.height=this.m_size.height+"px";MessageDialog.sOptGroupCounter++}
MessageDialog._onClickedOption=function(){this.m_dialog.m_selOption=this.m_index;var opts=this.parentNode.getElementsByTagName("input");for(var i=0;i<opts.length;++i)
opts[i].checked=(opts[i]==this);return true}
MessageDialog._onChangedPrompt=function(){this.m_dialog.m_promptText=this.value}
MessageDialog.prototype.init=function(){}
MessageDialog.prototype.onAfterShow=function(){if(this.m_input){this.m_input.getElement().select();this.m_input.getElement().focus()}}
function Font(){this.m_family="sans-serif";this.m_size="9pt";this.m_bold=false;this.m_italic=false}
Font.prototype.setFamily=function(f){this.m_family=f}
Font.prototype.getFamily=function(){return this.m_family}
Font.prototype.setSize=function(s){this.m_size=s}
Font.prototype.getSize=function(){return this.m_size}
Font.prototype.setBold=function(b){this.m_bold=b}
Font.prototype.isBold=function(){return this.m_bold}
Font.prototype.setItalic=function(i){this.m_italic=i}
Font.prototype.isItalic=function(){return this.m_italic}
Font.prototype.applyToHTMLElement=function(elt){var style=elt.style;style.fontFamily=this.m_family;style.fontSize=this.m_size;style.fontWeight=(this.m_bold?"bold":"normal");style.fontStyle=(this.m_italic?"italic":"normal")}
function Control(){}
Control.prototype.getElement=function(){return null}
Control.prototype.resize=function(size){}
Control.prototype.create=function(parent){}
function Layout(){}
Layout.prototype.layoutContainer=function(container){}
Layout.prototype.getPreferredLayoutSize=function(container){return new Size(100,100)}
function GridLayout(rows,cols,hgap,vgap){Layout.call(this);this.m_rows=rows;this.m_cols=cols;this.m_hgap=(hgap!=window.undefined?hgap:10);this.m_vgap=(vgap!=window.undefined?vgap:10)}
GridLayout.prototype=new Layout();GridLayout.prototype.layoutContainer=function(container){var padding=container.getPadding();var cellSizes=this._computeSizes(container);var colWidth=cellSizes[0];var rowHeight=cellSizes[1];var children=container.getComponents();var row=0,col=0,x=padding.x1,y=padding.y1;for(var i=0;i<children.length;++i){var adjust=children[i].getPositionAdjustment();var elt=children[i].getElement().getElement();HTMLUtils.setElementPos(elt,new Point(x+adjust.x,y+adjust.y));if(++col>=this.m_cols){col=0;++row;x=padding.x1;y+=rowHeight[row-1]+this.m_vgap}else
{x+=colWidth[col-1]+this.m_hgap}}}
GridLayout.prototype.getPreferredLayoutSize=function(container){var padding=container.getPadding();var cellSizes=this._computeSizes(container);var colWidth=cellSizes[0];var rowHeight=cellSizes[1];var w=0,h=0;for(var r=0;r<rowHeight.length;++r)
h+=rowHeight[r];for(var c=0;c<colWidth.length;++c)
w+=colWidth[c];h+=this.m_vgap*(rowHeight.length-1);w+=this.m_hgap*(colWidth.length-1);return new Size(padding.x1+w+padding.x2,padding.y1+h+padding.y2)}
GridLayout.prototype._computeSizes=function(container){var colWidth=new Array();var rowHeight=new Array();for(var r=0;r<this.m_rows;++r)
rowHeight[r]=0;for(var c=0;c<this.m_cols;++c)
colWidth[c]=0;var children=container.getComponents();var row=0,col=0;for(var i=0;i<children.length;++i){var size=children[i].getSize();rowHeight[row]=Math.max(row>=this.m_rows?0:rowHeight[row],size.height);colWidth[col]=Math.max(colWidth[col],size.width);if(++col>=this.m_cols){col=0;++row}}
return[colWidth,rowHeight]}
function LineLayout(hgap,vgap){GridLayout.call(this,1,1,hgap?hgap:0,vgap?vgap:5)}
LineLayout.prototype=new GridLayout();function FlowLayout(ori,align,hgap,vgap){Layout.call(this);this.m_ori=(ori!=window.undefined?ori:FlowLayout.ORIENTATION_DEFAULT);if(align==window.undefined||align==FlowLayout.ALIGN_DEFAULT){if(this.m_ori==FlowLayout.ORIENTATION_HORZ)
this.m_align=FlowLayout.ALIGN_LEFT|FlowLayout.ALIGN_MIDDLE;else
this.m_align=FlowLayout.ALIGN_LEFT|FlowLayout.ALIGN_TOP}else
{this.m_align=align}
this.m_hgap=(hgap!=window.undefined?hgap:8);this.m_vgap=(vgap!=window.undefined?vgap:8)}
FlowLayout.ORIENTATION_HORZ=1;FlowLayout.ORIENTATION_VERT=2;FlowLayout.ORIENTATION_DEFAULT=FlowLayout.ORIENTATION_HORZ;FlowLayout.ALIGN_LEFT=0x1;FlowLayout.ALIGN_RIGHT=0x2;FlowLayout.ALIGN_CENTER=0x4;FlowLayout.ALIGN_HORZ=0xf;FlowLayout.ALIGN_TOP=0x10;FlowLayout.ALIGN_BOTTOM=0x20;FlowLayout.ALIGN_MIDDLE=0x40;FlowLayout.ALIGN_VERT=0xf0;FlowLayout.ALIGN_DEFAULT=0;FlowLayout.prototype.layoutContainer=function(container){this._adjustComponents(container,false)}
FlowLayout.prototype.getPreferredLayoutSize=function(container){return this._adjustComponents(container,true)}
FlowLayout.prototype._adjustComponents=function(container,computeOnly){var children=container.getComponents();var childSize=new Array();var width=0,height=0;var actualWidth=0,actualHeight=0;var padding=container.getPadding();for(var i=0,n=0;i<children.length;++i){var child=children[i];if(child.isVisible()){var size=child.getSize();childSize[i]=size;if(this.m_ori==FlowLayout.ORIENTATION_VERT){width=Math.max(width,size.width);height+=size.height+(n!=0?this.m_vgap:0)}else
{width+=size.width+(n!=0?this.m_hgap:0);height=Math.max(height,size.height)}
++n}
actualWidth=width;actualHeight=height;var prefSize=container.getPreferredSize();if(prefSize!=null){if(prefSize.width!=null)
width=Math.max(width,prefSize.width);if(prefSize.height!=null)
height=Math.max(height,prefSize.height)}}
if(!computeOnly){var x,y;var contSize=HTMLUtils.getElementSize(container.getHTMLElement());if(this.m_ori==FlowLayout.ORIENTATION_VERT){x=padding.x1;switch(this.m_align&FlowLayout.ALIGN_VERT){default:case FlowLayout.ALIGN_TOP:y=padding.y1;break;case FlowLayout.ALIGN_MIDDLE:y=padding.y1+(Math.round(contSize.height-actualHeight)/2);break;case FlowLayout.ALIGN_BOTTOM:y=padding.y1+contSize.height-actualHeight;break}}else
{y=padding.y1;switch(this.m_align&FlowLayout.ALIGN_HORZ){default:case FlowLayout.ALIGN_LEFT:x=padding.x1;break;case FlowLayout.ALIGN_CENTER:x=padding.x1+(Math.round(contSize.width-actualWidth)/2);break;case FlowLayout.ALIGN_RIGHT:x=padding.x1+contSize.width-actualWidth;break}}
for(var i=0;i<children.length;++i){var child=children[i];if(child.isVisible()){var size=childSize[i];var cx=x,cy=y;if(this.m_ori==FlowLayout.ORIENTATION_VERT){switch(this.m_align&FlowLayout.ALIGN_HORZ){case FlowLayout.ALIGN_LEFT:cx=x;break;case FlowLayout.ALIGN_CENTER:cx=x+Math.round((width-size.width)/2);break;case FlowLayout.ALIGN_RIGHT:cx=x+width-size.width;break}}else
{switch(this.m_align&FlowLayout.ALIGN_VERT){case FlowLayout.ALIGN_TOP:cy=y;break;case FlowLayout.ALIGN_MIDDLE:cy=y+Math.round((height-size.height)/2);break;case FlowLayout.ALIGN_BOTTOM:cy=y+height-size.height;break}}
var adjust=child.getPositionAdjustment();var elt=child.getElement().getElement();HTMLUtils.setElementPos(elt,new Point(cx+adjust.x,cy+adjust.y));if(this.m_ori==FlowLayout.ORIENTATION_VERT){y+=size.height+this.m_vgap}else
{x+=size.width+this.m_hgap}}}}
return new Size(padding.x1+width+padding.x2,padding.y1+height+padding.y2)}
function ComponentListener(){}
ComponentListener.prototype.onFocus=function(){}
ComponentListener.prototype.onBlur=function(){}
ComponentListener.prototype.onResize=function(size){}
ComponentListener.prototype.onClick=function(ev){}
function Component(){IDM.Object.call(this);this.m_size=null;this.m_element=null;this.m_constraint=null;this.m_parent=null;this.m_visible=true;this.m_listeners=new ArrayList();this.m_padding=new Rect();this.m_cachedSize=null;this.m_tag=null;this.m_enabled=true;this.m_standalone=false}
Component.prototype=new IDM.Object();Component._onClick=function(e){if(this.m_comp.isEnabled())this.m_comp.fireListeners("onClick",DOMEventUtils.getEvent(e))}
Component._onFocus=function(){if(this.m_comp.isEnabled())this.m_comp.fireListeners("onFocus")}
Component._onBlur=function(){if(this.m_comp.isEnabled())this.m_comp.fireListeners("onBlur")}
Component.prototype.destroy=function(){var elt=this.m_element.getElement();elt.parentNode.removeChild(elt)}
Component.prototype.getPreferredSize=function(){return this.m_size}
Component.prototype.setPreferredSize=function(size){this.m_size=size}
Component.prototype.getElement=function(){return this.m_element}
Component.prototype.getHTMLElement=function(){return this.m_element.getElement()}
Component.prototype.setConstraint=function(c){this.m_constraint=c}
Component.prototype.getConstraint=function(){return this.m_constraint}
Component.prototype.getParent=function(){return this.m_parent}
Component.prototype.getRootParent=function(){var parent=this.getParent();return(parent==null?this:parent.getRootParent())}
Component.prototype.setParent=function(parent){var elt=this.m_element.getElement();if(parent==null)
Component._getElementPool().appendChild(elt);else
parent.getElement().getElement().appendChild(elt);this.m_parent=parent}
Component.prototype.setStandalone=function(sa){this.m_standalone=(sa==window.undefined?true:(sa?true:false));var elt=this.m_element.getElement();if(this.m_standalone)
elt.style.left=elt.style.top="";else
elt.style.left=elt.style.top="-10000px"}
Component.prototype.isStandalone=function(){return this.m_standalone}
Component.prototype.pack=function(){var size=this.getSize();var elt=this.getElement().getElement();HTMLUtils.setElementSize(elt,size);this.fireListeners("onResize",size);return size}
Component.prototype.getSize=function(){var csize=this.computeSize();if(this.m_size!==null){if(this.m_size.width!=null)
csize.width=this.m_size.width;if(this.m_size.height!=null)
csize.height=this.m_size.height}
this.m_cachedSize=csize;return csize}
Component.prototype.resize=function(size){this._onResize(size);this.fireListeners("onResize",size)}
Component.prototype.computeSize=function(){var elt=this.getHTMLElement();return HTMLUtils.getElementSize(elt)}
Component.gElementPool=null;Component._getElementPool=function(){if(Component.gElementPool==null){var elt=document.createElement("div");elt.style.display="none";document.body.appendChild(elt);Component.gElementPool=elt}
return Component.gElementPool}
Component.prototype.createElement=function(tagName){var elt=null;if(typeof(tagName)=="string")
elt=document.createElement(tagName);else
elt=tagName;Component._getElementPool().appendChild(elt);this.m_element=NodeRef.create(elt);this._setupElement(elt);return this.m_element}
Component.prototype._setupElement=function(elt){elt.style.position="absolute";elt.style.left="-10000px";elt.style.top="-10000px";elt.m_comp=this;elt.onclick=Component._onClick;elt.onfocus=Component._onFocus;elt.onblur=Component._onBlur}
Component.wrap=function(htmlElt){var c=new Component();Component._getElementPool().appendChild(htmlElt);c.m_element=NodeRef.create(htmlElt);htmlElt.m_comp=c;c._setupElement(htmlElt);return c}
Component.prototype.setAbsolute=function(abs){this.getHTMLElement().style.position=(abs?"absolute":"")}
Component.prototype.isVisible=function(){if(!this.m_parent)
return this.m_visible;else
return this.m_visible&&this.m_parent.isVisible()}
Component.prototype.show=function(){this.setVisible(true)}
Component.prototype.hide=function(){this.setVisible(false)}
Component.prototype.setVisible=function(show){this.m_visible=show;this.getHTMLElement().style.display=(show?"":"none");this.getRootParent().pack()}
Component.prototype.isEnabled=function(){if(!this.m_parent)
return this.m_enabled;else
return this.m_enabled&&this.m_parent.isEnabled()}
Component.prototype.setEnabled=function(enabled){this.m_enabled=enabled;this._updateState()}
Component.prototype._updateState=function(){var enabled=this.isEnabled();var elt=this.getHTMLElement();elt.disabled=!enabled;if(this.m_enabled)
HTMLUtils.removeStyleClass(elt,"disabled");else
HTMLUtils.addStyleClass(elt,"disabled")}
Component.prototype.addListener=function(lst){this.m_listeners.add(lst)}
Component.prototype.removeListener=function(lst){this.m_listener.removeAt(this.m_listeners.find(lst))}
Component.prototype.fireListeners=function(funcName,p1,p2,p3,p4,p5){for(var i=0;i<this.m_listeners.getCount();++i){var func=null;var lst=this.m_listeners.getAt(i);eval("func = lst."+funcName);if(func)
func.call(lst,p1,p2,p3,p4,p5)}}
Component.prototype.getPositionAdjustment=function(){return new Point(0,0)}
Component.prototype.getPadding=function(){return this.m_padding}
Component.prototype.setPadding=function(rect){this.m_padding=rect}
Component.prototype.getTag=function(){return this.m_tag}
Component.prototype.setTag=function(tag){this.m_tag=tag}
Component.prototype._onResize=function(size){var elt=this.getHTMLElement();HTMLUtils.setElementSize(elt,size)}
function Container(layout){Component.call(this);this.m_layout=(layout!=window.undefined?layout:new FlowLayout());this.m_children=new Array()}
Container.prototype=new Component();Container.prototype.setLayout=function(layout){this.m_layout=layout}
Container.prototype.addComponent=function(comp,constraint){comp.setConstraint(constraint);comp.setParent(this);this.m_children[this.m_children.length]=comp;return this}
Container.prototype.removeAllComponents=function(){this.m_children=new Array()}
Container.prototype.removeComponent=function(comp){var newChildren=new Array();for(var i=0;i<this.m_children.length;++i){var c=this.m_children[i];if(c!=comp)
newChildren[newChildren.length]=c}
comp.setParent(null);this.m_children=newChildren}
Container.prototype.getComponents=function(){return this.m_children}
Container.prototype.getComponentCount=function(){return this.m_children.length}
Container.prototype.getComponentAt=function(index){return this.m_children[index]}
Container.prototype.computeSize=function(){return this.m_layout.getPreferredLayoutSize(this)}
Container.prototype.pack=function(){var size=Component.prototype.pack.call(this);for(var i=0;i<this.m_children.length;++i){if(this.m_children[i].isVisible())
this.m_children[i].pack()}
this.m_layout.layoutContainer(this);return size}
Container.prototype._updateState=function(){Component.prototype._updateState.call(this);for(var i=0;i<this.m_children.length;++i)
this.m_children[i]._updateState()}
function Panel(layout){Container.call(this,layout);this.createElement("div")}
Panel.prototype=new Container();function Frame(label){Container.call(this);this.m_label=new Label(label);this.m_label.getHTMLElement().className="title";this.createElement("div");var elt=this.getHTMLElement();elt.className="frame";var border=document.createElement("div");border.style.position="absolute";border.className="border";elt.appendChild(border);this.m_border=NodeRef.create(border);elt.appendChild(this.m_label.getHTMLElement());this.setLayout(new FlowLayout(FlowLayout.ORIENTATION_VERT,FlowLayout.ALIGN_LEFT))}
Frame.prototype=new Container();Frame.prototype.getPadding=function(){return new Rect(10,this.m_label.getSize().height+8,10,10)}
Frame.prototype.pack=function(){var size=Container.prototype.pack.call(this);var label=this.m_label.getElement().getElement();HTMLUtils.setElementPos(label,new Point(10,0));var border=this.m_border.getElement();HTMLUtils.setElementPos(border,new Point(0,5));HTMLUtils.setElementSize(border,new Size(size.width,size.height-5))}
Frame.prototype.computeSize=function(){var size=Container.prototype.computeSize.call(this);var labelSize=this.m_label.getSize();if(size.width<labelSize.width+20)
size.width=labelSize.width+20;return size}
Frame.prototype._onResize=function(size){Component.prototype._onResize.call(this,size);var border=this.m_border.getElement();HTMLUtils.setElementSize(border,new Size(size.width,size.height-5))}
function Label(text,maxWidth){Component.call(this);this.m_maxWidth=(maxWidth?maxWidth:0);this.createElement("div");this.setText(text?text:"")}
Label.prototype=new Component();Label.prototype.setText=function(text){this.m_text=text;var elt=this.getHTMLElement();elt.innerHTML=text;var size=HTMLUtils.computeTextSize
(text,this.m_maxWidth,elt,"dialog-frame-font");var minHeight=HTMLUtils.emToPx(1.2);if(size.height<minHeight){size.height=minHeight;elt.style.lineHeight="1.2em"}else
{elt.style.lineHeight=""}
this.m_defaultSize=size}
Label.prototype.setParent=function(p){Component.prototype.setParent.call(this,p);this.setText(this.m_text)}
Label.prototype.getText=function(){var elt=this.getHTMLElement();return elt.innerHTML}
Label.prototype.computeSize=function(){return this.m_defaultSize}
function Button(innerComp){Container.call(this);this.createElement("div");this.setLayout(new FlowLayout(FlowLayout.ORIENTATION_DEFAULT,FlowLayout.ALIGN_DEFAULT,7,5));var elt=this.getHTMLElement();elt.className="button";elt.style.border="";elt.style.padding="0";elt.style.margin="0";if(innerComp)
this.addComponent(innerComp)}
Button.prototype=new Container();Button.prototype.computeSize=function(){return Container.prototype.computeSize.call(this)}
function CheckBoxListener(){}
CheckBoxListener.prototype=new ComponentListener();CheckBoxListener.prototype.onClickedCheckBox=function(btn){}
function CheckBox(label,checked){Container.call(this);this.createElement("div");this.setLayout(new FlowLayout(FlowLayout.ORIENTATION_HORZ));this.m_innerBtn=new CheckBox.InnerButton(this);var lbl=new Label(label);var lblElt=lbl.getHTMLElement();lblElt.style.cursor="pointer";lblElt.onclick=CheckBox.InnerButton._onClick;lblElt.ondoubleclick=CheckBox.InnerButton._onClick;lblElt.m_btn=this.m_innerBtn;this.addComponent(this.m_innerBtn);this.addComponent(lbl);if(checked)
this.setChecked(true)}
CheckBox.prototype=new Container();CheckBox.prototype.isChecked=function(){return this.m_innerBtn.isChecked()}
CheckBox.prototype.setChecked=function(val){this.m_innerBtn.setChecked(val?true:false)}
CheckBox.InnerButton=function(btn){Component.call(this);this.m_btn=btn;var elt=null;if(window.ActiveXObject){var tmp=document.createElement("div");tmp.innerHTML='<input type="checkbox"/>';this.createElement(tmp.childNodes[0]);elt=this.getHTMLElement()}else
{this.createElement("input");elt=this.getHTMLElement();elt.type="checkbox"}
elt.style.cursor="pointer";elt.onclick=CheckBox.InnerButton._onClickCheckbox;elt.ondoubleclick=CheckBox.InnerButton._onClickCheckbox;elt.m_btn=this}
CheckBox.InnerButton.prototype=new Component();CheckBox.InnerButton.prototype.getPositionAdjustment=function(){if(window.ActiveXObject)
return new Point(0,0);else
return new Point(-1,-3)}
CheckBox.InnerButton.prototype.isChecked=function(){return(this.getHTMLElement().checked?true:false)}
CheckBox.InnerButton.prototype.setChecked=function(val){var elt=this.getHTMLElement();elt.checked=val;elt.defaultChecked=val}
CheckBox.InnerButton._onClick=function(){var elt=this.m_btn.getHTMLElement();elt.checked=!elt.checked;this.m_btn.m_btn.fireListeners("onClickedCheckBox",this.m_btn.m_btn);return false}
CheckBox.InnerButton._onClickCheckbox=function(){this.m_btn.m_btn.fireListeners("onClickedCheckBox",this.m_btn.m_btn)}
function RadioButtonGroup(){this.m_id="RadioButtonGroup"+(++RadioButtonGroup.s_count);this.m_sel=null;this.m_listeners=new ArrayList()}
RadioButtonGroup.s_count=0;RadioButtonGroup.prototype.getId=function(){return this.m_id}
RadioButtonGroup.prototype.getSelectedOption=function(){return this.m_sel}
RadioButtonGroup.prototype.setSelectedOption=function(tag){this._setSelectedOptionImpl(tag);for(var i=0,n=this.m_listeners.getCount();i<n;++i)
this.m_listeners.getAt(i).onSelectedOption(tag)}
RadioButtonGroup.prototype._setSelectedOptionImpl=function(tag){this.m_sel=tag}
RadioButtonGroup.prototype.addListener=function(l){this.m_listeners.add(l)}
function RadioButtonListener(){}
RadioButtonListener.prototype=new ComponentListener();RadioButtonListener.prototype.onClickedRadioButton=function(btn){}
function RadioButton(innerComp,group,tag,ori,checked,label){Container.call(this);if(!ori)
ori=RadioButton.ORIENTATION_DEFAULT;this.m_tag=tag;this.m_group=group;group.addListener(this);this.createElement("div");this.setLayout(new FlowLayout(ori==RadioButton.ORIENTATION_HORZ?FlowLayout.ORIENTATION_HORZ:FlowLayout.ORIENTATION_VERT,FlowLayout.ALIGN_CENTER,7,5));var elt=this.getHTMLElement();elt.style.border="";elt.style.padding="0";elt.style.margin="0";if(innerComp)
Container.prototype.addComponent.call(this,innerComp);this.m_innerBtn=new RadioButton.InnerButton(this,group.getId());if(!label){Container.prototype.addComponent.call(this,this.m_innerBtn)}else
{var lbl=new Label(label);var lblElt=lbl.getHTMLElement();lblElt.style.cursor="pointer";lblElt.onclick=RadioButton.InnerButton._onClick;lblElt.m_btn=this.m_innerBtn;var panel=new Panel();panel.addComponent(this.m_innerBtn);panel.addComponent(lbl);Container.prototype.addComponent.call(this,panel)}
if(checked)
this.setChecked(true)}
RadioButton.ORIENTATION_HORZ=1;RadioButton.ORIENTATION_VERT=2;RadioButton.ORIENTATION_DEFAULT=RadioButton.ORIENTATION_HORZ;RadioButton.prototype=new Container();RadioButton.prototype.addComponent=function(comp){this.removeComponent(this.m_innerBtn);Container.prototype.addComponent.call(this,comp);Container.prototype.addComponent.call(this,this.m_innerBtn)}
RadioButton.prototype.isChecked=function(){return this.m_innerBtn.isChecked()}
RadioButton.prototype.setChecked=function(val){this.m_innerBtn.setChecked(val?true:false)}
RadioButton.prototype.onSelectedOption=function(tag){this.setChecked(tag==this.m_tag)}
RadioButton.InnerButton=function(btn,groupId){Component.call(this);this.m_btn=btn;var elt=null;if(window.ActiveXObject){var tmp=document.createElement("div");tmp.innerHTML='<input type="radio" name="'+groupId+'"/>';this.createElement(tmp.childNodes[0]);elt=this.getHTMLElement()}else
{this.createElement("input");elt=this.getHTMLElement();elt.type="radio"}
elt.name=groupId;elt.style.cursor="pointer";elt.onclick=RadioButton.InnerButton._onClick;elt.m_btn=this}
RadioButton.InnerButton.prototype=new Component();RadioButton.InnerButton.prototype.isChecked=function(){return(this.getHTMLElement().checked?true:false)}
RadioButton.InnerButton.prototype.setChecked=function(val){var elt=this.getHTMLElement();elt.checked=val;elt.defaultChecked=val;if(val)
this.m_btn.m_group._setSelectedOptionImpl(this.m_btn.m_tag)}
RadioButton.InnerButton._onClick=function(){this.m_btn.getHTMLElement().checked=true;this.m_btn.m_btn.m_group.setSelectedOption(this.m_btn.m_btn.m_tag);this.m_btn.m_btn.fireListeners("onClickedRadioButton",this.m_btn.m_btn)}
IDM.Image=function(source,width,height){this.m_width=(width?width:0);this.m_height=(height?height:0);this.m_autoImg=null;this.createElement("div");if(source!=null&&source!=window.undefined&&source.length!=0)
this.setSource(source)}
IDM.Image.prototype=new Component();IDM.Image.prototype.getSource=function(){return this.m_source}
IDM.Image.prototype.setSource=function(source){this.m_source=source;if(this.m_width==0||this.m_height==0){if(this.m_autoImg==null){var autoImg=document.createElement("img");autoImg.src=source;autoImg.style.position="absolute";autoImg.style.left="-1000px";autoImg.style.top="-1000px";this.getHTMLElement().appendChild(autoImg);this.m_autoImg=NodeRef.create(autoImg)}
var autoImg=this.m_autoImg.getElement();autoImg.m_comp=this;autoImg.onload=IDM.Image._onAutoImgLoad;autoImg.onreadystatechange=IDM.Image._onAutoImgReadyStateChange;autoImg.noiehack="true";autoImg.src=source}else
{this._onImageLoaded()}}
IDM.Image._onAutoImgLoad=function(){this.m_comp._onImageLoaded()}
IDM.Image._onAutoImgReadyStateChange=function(){if(this.readystate==4||this.readystate=="complete")
this.m_comp._onImageLoaded()}
IDM.Image.prototype.computeSize=function(){var w=this.m_width;var h=this.m_height;var elt=this.getHTMLElement();var size=HTMLUtils.getElementSize(elt);if(w==0)w=size.width;if(h==0)h=size.height;return new Size(w,h)}
IDM.Image.prototype._onImageLoaded=function(){var elt=this.getHTMLElement();elt.style.backgroundPosition="50% 50%";if(this.m_width==0||this.m_height==0){if(this.m_autoImg==null)
return;var elt=this.getHTMLElement();var autoImg=this.m_autoImg.getElement();var size=HTMLUtils.getElementSize(autoImg);HTMLUtils.setElementSize(elt,size);this.getRootParent().pack()}else
{HTMLUtils.setElementSize(elt,new Size(this.m_width,this.m_height))}
if(window.ActiveXObject)
elt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.m_source+"', sizingMethod='scale')"
else
elt.style.backgroundImage="url("+this.m_source+")"}
function TextComponentListener(){}
TextComponentListener.prototype=new ComponentListener();TextComponentListener.prototype.onTextChanged=function(){}
function TextComponent(){Component.call(this);this.m_editable=true}
TextComponent.prototype=new Component();TextComponent.prototype.isEditable=function(){return this.m_editable}
TextComponent.prototype.setEditable=function(e){this.m_editable=e}
TextComponent.prototype.getText=function(){return""}
TextComponent.prototype.setText=function(text){}
function TextField(defaultValue){TextComponent.call(this);this.createElement("input");var elt=this.getHTMLElement();elt.className="text-field";elt.type="text";if(defaultValue)
elt.value=defaultValue;elt.m_comp=this;elt.onkeyup=TextField._onKeyUp}
TextField.prototype=new TextComponent();TextField._onKeyUp=function(){this.m_comp.fireListeners("onTextChanged")}
TextField.prototype.getText=function(){return this.getHTMLElement().value}
TextField.prototype.setText=function(text){this.getHTMLElement().value=text}
TextField.prototype.computeSize=function(){return new Size(50,HTMLUtils.emToPx(1.4))}
TextField.prototype.getPositionAdjustment=function(){if(window.ActiveXObject)
return new Point(0,0);else
return new Point(-1,-3)}
function TextArea(){TextComponent.call(this);this.createElement("textarea");var elt=this.getHTMLElement();elt.m_comp=this;elt.onkeyup=TextArea._onKeyUp;elt.onfocus=TextArea._onFocus;elt.onblur=TextArea._onBlur}
TextArea.prototype=new TextComponent();TextArea._onKeyUp=function(){this.m_comp.fireListeners("onTextChanged")}
TextArea._onFocus=function(){this.m_comp.fireListeners("onFocus")}
TextArea._onBlur=function(){this.m_comp.fireListeners("onBlur")}
TextArea.prototype.getText=function(){return this.getHTMLElement().value}
TextArea.prototype.setText=function(text){this.getHTMLElement().value=text}
TextArea.prototype.computeSize=function(){return new Size(250,50)}
function ChoiceBoxListener(){}
ChoiceBoxListener.prototype=new ComponentListener();ChoiceBoxListener.prototype.onItemSelected=function(item){}
ChoiceBoxListener.prototype.onItemsChanged=function(){}
function ChoiceBox(){Component.call(this);this.createElement("select");this.m_items=new ArrayList();this.m_disableNotify=false;var elt=this.getHTMLElement();elt.m_choiceBox=this;elt.onchange=ChoiceBox._onChangeSelect;elt.onkeyup=ChoiceBox._onChangeSelect}
ChoiceBox.prototype=new Component();ChoiceBox.prototype.getItems=function(){return this.m_items}
ChoiceBox.prototype.getSelectedIndex=function(){return this.getHTMLElement().selectedIndex}
ChoiceBox.prototype.setSelectedIndex=function(pos){this.m_disableNotify=true;var selItem=null;var options=this.getHTMLElement().options;for(var i=0;i<this.m_items.getCount();++i){var item=this.m_items.getAt(i);if(i===pos){selItem=item;if(i<options.length)
options[i].selected=true;break}}
this.m_disableNotify=false;return selItem}
ChoiceBox.prototype.setSelectedValue=function(val){this.m_disableNotify=true;var selItem=null;var options=this.getHTMLElement().options;for(var i=0;i<this.m_items.getCount();++i){var item=this.m_items.getAt(i);if(item.getValue()===val){selItem=item;if(i<options.length)
options[i].selected=true;break}}
this.m_disableNotify=false;return selItem}
ChoiceBox.prototype.getSelectedItem=function(){var selVal=this.getElement().getElement().value;for(var i=0;i<this.m_items.getCount();++i){var item=this.m_items.getAt(i);if(item.getValue()==selVal)
return item}
return null}
ChoiceBox.prototype.setSelectedItem=function(item){for(var i=0;i<this.m_items.getCount();++i){if(this.m_items.getAt(i)==item){this.setSelectedIndex(i);return}}}
ChoiceBox.prototype.select=function(x){this.m_disableNotify=true;var selItem=null;var options=this.getElement().getElement().options;for(var i=0;i<this.m_items.getCount();++i){var item=this.m_items.getAt(i);if(item.getValue()===x||i==Number(x)){selItem=item;if(i<options.length)
options[i].selected=true;break}}
this.m_disableNotify=false;return selItem}
ChoiceBox.prototype.remove=function(x){var items=this.m_items;var newItems=new ArrayList();for(var i=0;i<items.getCount();++i){var item=items.getAt(i);if(!((typeof(x)=="string"&&item.getValue()==x)||i==Number(x)))
newItems.add(item)}
this.setItems(items)}
ChoiceBox.prototype.removeAll=function(){this.setItems(new ArrayList())}
ChoiceBox.prototype.setItems=function(items){this.m_items=items;this._updateItems()}
ChoiceBox.prototype.addItem=function(item){this.m_items.add(item);this._updateItems()}
ChoiceBox.prototype._updateItems=function(){var items=this.m_items;var elt=this.getElement().getElement();XMLUtils.removeAllChildren(elt);if(window.ActiveXObject){var options=elt.options;for(var i=0,n=items.getCount();i<n;++i){var item=items.getAt(i);options[i]=new Option(item.getText(),""+item.getValue(),false,false)}
for(var j=i;j<options.length;++j)
options[j]=null}else
{for(var i=0,n=items.getCount();i<n;++i){var item=items.getAt(i);elt.appendChild(new Option(item.getText(),""+item.getValue(),false,false))}}
this.fireListeners("onItemsChanged")}
ChoiceBox._onChangeSelect=function(){var cb=this.m_choiceBox;var index=cb.getSelectedIndex();if(cb.m_disableNotify)
return;if(index<0||index>=cb.m_items.getCount())
return;cb.fireListeners("onItemSelected",cb.getItems().getAt(index))}
ChoiceBox.Item=function(text,value){this.m_text=text;this.m_value=(value!==window.undefined?value:text)}
ChoiceBox.Item.prototype.getValue=function(){return this.m_value}
ChoiceBox.Item.prototype.getText=function(){return this.m_text}
function ListBoxListener(){}
ListBoxListener.prototype=new ComponentListener();ListBoxListener.prototype.onItemSelected=function(item){}
function ListBox(){Component.call(this);this.createElement("div");var elt=this.getHTMLElement();elt.className="listbox";this.m_items=new ArrayList();this.m_sel=null}
ListBox.prototype=new Component();ListBox.prototype.pack=function(){Component.prototype.pack.call(this);var y=0;for(var i=0;i<this.m_items.getCount();++i){var item=this.m_items.getAt(i);var itemElt=item.getHTMLElement();var itemSize=item.getSize();item.pack();HTMLUtils.setElementPos(itemElt,new Point(0,y));y+=itemSize.height}}
ListBox.prototype.computeSize=function(){var width=0,height=0;for(var i=0;i<this.m_items.getCount();++i){var item=this.m_items.getAt(i);var size=item.getSize();width=Math.max(width,size.width);height+=size.height}
if(width<=0)width=100;if(height<=0)height=50;return new Size(width,height)}
ListBox.prototype.addItem=function(item){item.setParent(this);this.m_items.add(item)}
ListBox.prototype.getItemAt=function(index){return this.m_items.getAt(index)}
ListBox.prototype.setSelectedItem=function(item){if(this.m_sel!=null)
this.m_sel.removeFlags(ListBox.Item.FLAG_SELECTED);this.m_sel=item;if(item!=null)
item.addFlags(ListBox.Item.FLAG_SELECTED);this.fireListeners("onItemSelected",item)}
ListBox.prototype.getSelectedItem=function(){return this.m_sel}
ListBox.Item=function(text,image,tag,innerComp){Container.call(this);this.setLayout(new FlowLayout(FlowLayout.ORIENTATION_DEFAULT,FlowLayout.ALIGN_CENTER,6,3));this.createElement("div");this.m_flags=ListBox.Item.FLAG_DEFAULT;this.m_tag=tag;if(innerComp!=window.undefined){this.addComponent(innerComp);innerComp.getHTMLElement().style.cursor="pointer"}else
{if(image){var imageComp=new IDM.Image(image);this.addComponent(imageComp);imageComp.getHTMLElement().style.cursor="pointer"}
if(text){var labelComp=new Label(text);this.addComponent(labelComp);labelComp.getHTMLElement().style.cursor="pointer"}}
var itemElt=this.getElement().getElement();itemElt.m_item=this;itemElt.onclick=ListBox.Item._onClick;itemElt.style.cursor="pointer";itemElt.className="listbox-item clickable";this.setPadding(new Rect(5,5,5,5))}
ListBox.Item.FLAG_SELECTED=0x0001;ListBox.Item.FLAG_DEFAULT=0;ListBox.Item.prototype=new Container();ListBox.Item._onClick=function(){this.m_item.getParent().setSelectedItem(this.m_item)}
ListBox.Item.prototype.getTag=function(){return this.m_tag}
ListBox.Item.prototype.setTag=function(tag){this.m_tag=tag}
ListBox.Item.prototype.addFlags=function(flags){this.m_flags|=flags;this.redraw()}
ListBox.Item.prototype.removeFlags=function(flags){this.m_flags&=~flags;this.redraw()}
ListBox.Item.prototype.getFlags=function(){return this.m_flags}
ListBox.Item.prototype.redraw=function(){var itemElt=this.getElement().getElement();if(this.m_flags&ListBox.Item.FLAG_SELECTED)
HTMLUtils.addStyleClass(itemElt,"listbox-item-sel");else
HTMLUtils.removeStyleClass(itemElt,"listbox-item-sel")}
function ColorChooserListener(){}
ColorChooserListener.prototype=new ComponentListener();ColorChooserListener.prototype.onColorChanged=function(color){}
function ColorChooser(initialColor){Component.call(this);this.createElement("div");var elt=this.getHTMLElement();elt.className="color-selector";var input=document.createElement("input");input.type="hidden";elt.appendChild(input);var current=document.createElement("div");current.className="cur";elt.appendChild(current);var button=document.createElement("div");elt.appendChild(button);button.className="btn";button.m_comp=this;button.onclick=ColorChooser._onClickedButtonWrapper;this.m_input=NodeRef.create(input);this.m_current=NodeRef.create(current);this.m_button=NodeRef.create(button);this.m_color=null;this.setColor(initialColor!=window.undefined?initialColor:new Color(),true)}
ColorChooser.prototype=new Component();ColorChooser._onClickedButtonWrapper=function(btnElt){this.m_comp._onClickedButton()}
ColorChooser.prototype.setColor=function(color,dontNotify){this.m_color=color;if(color==null){this.m_input.getElement().value="";this.m_current.getElement().style.backgroundColor="";this.m_current.getElement().style.color=""}else
{var value=color.toHex();this.m_input.getElement().value=value;this.m_current.getElement().style.backgroundColor=value;this.m_current.getElement().style.color=color.getSuitableTextColor().toHex()}
if(!dontNotify)
this.fireListeners("onColorChanged",color)}
ColorChooser.prototype.getColor=function(){return this.m_color}
ColorChooser.prototype._onClickedButton=function(){var dlg=new IDM.ColorPickerDialog();dlg.setOnClickedButtonCallback(JSUtils.makeCallback(this,ColorChooser.prototype._onColorDialogClosed));dlg.setColor(this.getColor()==null?new Color(0,0,0):this.getColor());dlg.show()}
ColorChooser.prototype._onColorDialogClosed=function(dlg,result){if(result.getButton()!=IDM.Dialog.Button.CANCEL)
this.setColor(dlg.getColor());return true}
ColorChooser.prototype.computeSize=function(){return new Size(110,20)}
function FontChooser(){ChoiceBox.call(this);if(FontChooser.s_items==null){var listener=new HTTPRequestListener();listener.m_comp=this;listener.onHTTPResponse=function(responseText){var names=StringUtils.explode(";",responseText);FontChooser.s_items=new ArrayList();for(var i=0,n=names.length;i<n;++i)
FontChooser.s_items.add(new ChoiceBox.Item(names[i]));this.m_comp.setItems(FontChooser.s_items)}
var http=new HTTPRequest("/modules/text/_services/font.php",listener);http.send()}else
{this.setItems(FontChooser.s_items)}}
FontChooser.prototype=ChoiceBox.prototype;FontChooser.s_items=null;function FontChooserEx(modules,allowNone){ChoiceBox.call(this);this.m_modules=modules;this.m_allowNone=(allowNone===true);this._loadFonts()}
FontChooserEx.prototype=ChoiceBox.prototype;FontChooserEx.s_items=new Array();FontChooserEx.prototype._loadFonts=function(forceRefresh){var items=FontChooserEx.preloadFonts(this.m_modules,forceRefresh);if(this.m_allowNone){items=items.clone();items.insertAt(new ChoiceBox.Item("",null),0)}
this.setItems(items)}
FontChooserEx.getModulesHash=function(modules){if(!modules||modules.length==0)
modules="default";return(JSUtils.isArray(modules)?StringUtils.implode(",",modules):""+modules)}
FontChooserEx.invalidateCache=function(){FontChooserEx.s_items=[]}
FontChooserEx.preloadFonts=function(modules,forceReload){var moduleList=FontChooserEx.getModulesHash(modules);if(!FontChooserEx.s_items[moduleList]||forceReload){var http=new HTTPRequest("/modules/text/_services/font.php?cmd=enum&module="+escape(moduleList));var responseText=http.sendSync();var entries=StringUtils.explode(";",responseText);if(entries=="")
entries="default:default";var items=new ArrayList();for(var i=0,n=entries.length;i<n;++i){var entry=IDM.Font.fromString(entries[i]);if(entry!=null)
items.add(new ChoiceBox.Item(entry.getName(),entries[i]))}
FontChooserEx.s_items[moduleList]=items}
return FontChooserEx.s_items[moduleList]}
FontChooserEx.prototype.reloadFonts=function(){this._loadFonts(true)}
FontChooserEx.prototype.getSelectedFontEntry=function(){var item=this.getSelectedItem();if(!item)return null;return IDM.Font.fromString(item.getValue())}
FontChooserEx.prototype.selectFont=function(font){var fontEntry=(typeof(font)=="object"?font:IDM.Font.fromString(font));if(!fontEntry)return null;for(var i=0,n=this.m_items.getCount();i<n;++i){var item=this.m_items.getAt(i);var entry=IDM.Font.fromString(item.getValue());if(entry&&entry.getName()==fontEntry.getName()&&entry.getModule()==fontEntry.getModule()){this.setSelectedItem(item);return item}}
return null}
function ScrollPane(innerComp,maxSize){Container.call(this);this.createElement("div");this.m_isScrollPane=true;var elt=this.getHTMLElement();elt.style.overflow="auto";elt.className="scrollpane framed";this.setLayout(new FlowLayout(FlowLayout.ORIENTATION_HORZ,FlowLayout.ALIGN_LEFT));if(innerComp)
this.addComponent(innerComp)}
ScrollPane.prototype=new Container();ScrollPane.prototype.addComponent=function(comp,constraint){this.removeAllComponents();return Container.prototype.addComponent.call(this,comp,constraint)}
function ExtDialog(){Dialog.call(this);this.ExtDialog__m_box=null}
ExtDialog.prototype=new Dialog();ExtDialog.prototype.getBox=function(){if(this.ExtDialog__m_box==null)
this._createBox();return this.ExtDialog__m_box}
ExtDialog.prototype.getSize=function(){this.ExtDialog__m_box.pack();return this.ExtDialog__m_box.getSize()}
ExtDialog.prototype.construct=function(box){if(this.ExtDialog__m_box==null)
this._createBox();box.appendChild(this.ExtDialog__m_box.getHTMLElement())}
ExtDialog.prototype._createBox=function(){this.ExtDialog__m_box=new Panel();this.ExtDialog__m_box.m_dialog=this;var dialog=this;var lst=new Object();lst.onResize=function(size){dialog.setSize(size)}
this.ExtDialog__m_box.addListener(lst);this.ExtDialog__m_box.setStandalone()}
var g_needIEPNGFix=false;if(navigator.platform=="Win32"&&navigator.appName=="Microsoft Internet Explorer"&&window.attachEvent){var rslt=navigator.appVersion.match(/MSIE (\d+\.\d+)/,'');g_needIEPNGFix=(rslt!=null&&Number(rslt[1])>=5.5&&Number(rslt[1])<7);if(g_needIEPNGFix){document.writeln('<style type="text/css">img, input.image { visibility:hidden; } </style>');window.attachEvent("onload",fnLoadPngs)}}
function fnLoadPngs(){var rslt=navigator.appVersion.match(/MSIE (\d+\.\d+)/,'');var itsAllGood=(rslt!=null&&Number(rslt[1])>=5.5&&Number(rslt[1])<7);for(var i=document.images.length-1,img=null;(img=document.images[i]);i--){if(itsAllGood&&img.src.match(/\.png$/i)!=null){fnFixPng(img);img.attachEvent("onpropertychange",fnPropertyChanged)}
img.style.visibility="visible"}
var nl=document.getElementsByTagName("INPUT");for(var i=nl.length-1,e=null;(e=nl[i]);i--){if(e.className&&e.className.match(/\bimage\b/i)!=null){if(e.src.match(/\.png$/i)!=null){fnFixPng(e);e.attachEvent("onpropertychange",fnPropertyChanged)}
e.style.visibility="visible"}}}
function fnPropertyChanged(){if(window.event.propertyName=="src"){var el=window.event.srcElement;if(el.noiehack!=window.undefined&&!el.src.match(/spacer\.png$/i)){try{el.filters.item(0).src=el.src;el.src="/styles/default/images/page/spacer.png"}catch(x){}}}}
function dbg(o){var s="";var i=0;for(var p in o){s+=p+": "+o[p]+"\n";if(++i%10==0){alert(s);s=""}}
alert(s)}
function fnFixPng(img,w,h,stretch){if(img.noiehack!=window.undefined)
return;var src=img.src;if(src.match(/spacer\.png$/i)!=null)
return;img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='"+(stretch?"scale":"image")+"')";img.src="/styles/default/images/page/spacer.png";img.style.visibility="visible"}
if(typeof deconcept=="undefined")var deconcept=new Object();if(typeof deconcept.util=="undefined")deconcept.util=new Object();if(typeof deconcept.SWFObjectUtil=="undefined")deconcept.SWFObjectUtil=new Object();deconcept.SWFObject=function(swf,id,w,h,ver,c,quality,xiRedirectUrl,redirectUrl,detectKey){if(!document.getElementById){return}
this.DETECT_KEY=detectKey?detectKey:'detectflash';this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(swf){this.setAttribute('swf',swf)}
if(id){this.setAttribute('id',id)}
if(w){this.setAttribute('width',w)}
if(h){this.setAttribute('height',h)}
if(ver){this.setAttribute('version',new deconcept.PlayerVersion(ver.toString().split(".")))}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true}
if(c){this.addParam('bgcolor',c)}
var q=quality?quality:'high';this.addParam('quality',q);this.addParam('wmode','opaque');this.setAttribute('swLiveConnect','true');this.setAttribute('useExpressInstall',false);this.setAttribute('doExpressInstall',false);var xir=(xiRedirectUrl)?xiRedirectUrl:window.location;this.setAttribute('xiRedirectUrl',xir);this.setAttribute('redirectUrl','');if(redirectUrl){this.setAttribute('redirectUrl',redirectUrl)}}
deconcept.SWFObject.prototype={useExpressInstall:function(path){this.xiSWFPath=!path?"expressinstall.swf":path;this.setAttribute('useExpressInstall',true)},setAttribute:function(name,value){this.attributes[name]=value},getAttribute:function(name){return this.attributes[name]},addParam:function(name,value){this.params[name]=value},getParams:function(){return this.params},addVariable:function(name,value){this.variables[name]=value},getVariable:function(name){return this.variables[name]},getVariables:function(){return this.variables},getVariablePairs:function(){var variablePairs=new Array();var key;var variables=this.getVariables();for(key in variables){variablePairs[variablePairs.length]=key+"="+variables[key]}
return variablePairs},getSWFHTML:function(){var swfNode="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute('swf',this.xiSWFPath)}
swfNode='<embed type="application/x-shockwave-flash" src="'+this.getAttribute('swf')+'" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'" style="'+this.getAttribute('style')+'"';swfNode+=' id="'+this.getAttribute('id')+'" name="'+this.getAttribute('id')+'" ';var params=this.getParams();for(var key in params){swfNode+=[key]+'="'+params[key]+'" '}
var pairs=this.getVariablePairs().join("&");if(pairs.length>0){swfNode+='flashvars="'+pairs+'"'}
swfNode+='/>'}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute('swf',this.xiSWFPath)}
swfNode='<object id="'+this.getAttribute('id')+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'" style="'+this.getAttribute('style')+'">';swfNode+='<param name="movie" value="'+this.getAttribute('swf')+'" />';var params=this.getParams();for(var key in params){swfNode+='<param name="'+key+'" value="'+params[key]+'" />'}
var pairs=this.getVariablePairs().join("&");if(pairs.length>0){swfNode+='<param name="flashvars" value="'+pairs+'" />'}
swfNode+="</object>"}
return swfNode},write:function(elementId){if(this.getAttribute('useExpressInstall')){var expressInstallReqVer=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(expressInstallReqVer)&&!this.installedVer.versionIsValid(this.getAttribute('version'))){this.setAttribute('doExpressInstall',true);this.addVariable("MMredirectURL",escape(this.getAttribute('xiRedirectUrl')));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title)}}
if(this.skipDetect||this.getAttribute('doExpressInstall')||this.installedVer.versionIsValid(this.getAttribute('version'))){var n=(typeof elementId=='string')?document.getElementById(elementId):elementId;n.innerHTML=this.getSWFHTML();return true}else{if(this.getAttribute('redirectUrl')!=""){document.location.replace(this.getAttribute('redirectUrl'))}}
return false}}
deconcept.SWFObjectUtil.getPlayerVersion=function(){var PlayerVersion=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){PlayerVersion=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."))}}else if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var counter=3;while(axo){try{counter++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+counter);PlayerVersion=new deconcept.PlayerVersion([counter,0,0])}catch(e){axo=null}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");PlayerVersion=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always"}catch(e){if(PlayerVersion.major==6){return PlayerVersion}}
try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(e){}}
if(axo!=null){PlayerVersion=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","))}}
return PlayerVersion}
deconcept.PlayerVersion=function(arrVersion){this.major=arrVersion[0]!=null?parseInt(arrVersion[0]):0;this.minor=arrVersion[1]!=null?parseInt(arrVersion[1]):0;this.rev=arrVersion[2]!=null?parseInt(arrVersion[2]):0}
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major)return false;if(this.major>fv.major)return true;if(this.minor<fv.minor)return false;if(this.minor>fv.minor)return true;if(this.rev<fv.rev)return false;return true}
deconcept.util={getRequestParameter:function(param){var q=document.location.search||document.location.hash;if(param==null){return q}
if(q){var pairs=q.substring(1).split("&");for(var i=0;i<pairs.length;i++){if(pairs[i].substring(0,pairs[i].indexOf("="))==param){return pairs[i].substring((pairs[i].indexOf("=")+1))}}}
return""}}
deconcept.SWFObjectUtil.cleanupSWFs=function(){var objects=document.getElementsByTagName("OBJECT");for(var i=objects.length-1;i>=0;i--){objects[i].style.display='none';for(var x in objects[i]){if(typeof objects[i][x]=='function'){objects[i][x]=function(){}}}}}
if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs)}
window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true}}
if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id]}}
var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;IDM.Album=Class.define
({ctor:function(){this.m_id=null;this.m_title=null;this.m_size=null;this.m_count=null},static:{s_cache:[],getAll:function(){var albums=new ArrayList();var webs=new IDM.WebService(new URL("/modules/photo/_services/enum-albums.php"));if(webs.call()&&webs.isSuccess()){var dom=webs.getResult();var root=XMLUtils.getRootElement(dom);var albumNodes=XMLUtils.getChildrenByTagName(root,"album");for(var i=0,n=albumNodes.length;i<n;++i){var albumNode=albumNodes[i];var album=IDM.Album.createFromXML(albumNode);albums.add(album)}}
return albums},createFromXML:function(node){var album=new IDM.Album();if(!album.readFromXML(node))
return null;return album},enumAlbums:function(){var albums=new ArrayList();var webs=new IDM.WebService(new URL("/modules/photo/_services/enum-albums.php"));if(webs.call()&&webs.isSuccess()){var dom=webs.getResult();var root=XMLUtils.getRootElement(dom);var albumNodes=XMLUtils.getChildrenByTagName(root,"album");for(var i=0,n=albumNodes.length;i<n;++i){var albumNode=albumNodes[i];var album=IDM.Album.createFromXML(albumNode);albums.add(album)}}else
return null;return albums}},prototype:{getId:function(){return this.m_id},getTitle:function(){return this.m_title},setTitle:function(title){this.m_title=title},getSize:function(){return this.m_size},setSize:function(size){this.m_size=size},getCount:function(){return this.m_count},setCount:function(count){this.m_count=count},readFromXML:function(node){this.m_id=parseInt(node.getAttribute("id"));this.m_title=node.getAttribute("title");this.m_size=parseInt(node.getAttribute("size"));this.m_count=parseInt(node.getAttribute("count"));return true},writeToXML:function(doc){var node=doc.createElement("album");node.setAttribute("id",this.getId());node.setAttribute("title",this.getTitle());node.setAttribute("size",this.getSize());node.setAttribute("count",this.getCount());return node},getPhotos:function(allowCache){var cacheKey=this.getId();if(allowCache&&IDM.Album.s_cache[cacheKey])
return IDM.Album.s_cache[cacheKey].clone();var photos=new ArrayList();var webs=new IDM.WebService(new URL("/modules/photo/_services/enum-photos.php").addParam("album",this.getId()));if(webs.call()&&webs.isSuccess()){var dom=webs.getResult();var root=XMLUtils.getRootElement(dom);var photoNodes=XMLUtils.getChildrenByTagName(root,"photo");for(var i=0,n=photoNodes.length;i<n;++i){var photoNode=photoNodes[i];var photo=IDM.AlbumPhoto.createFromXML(photoNode);photo.setAlbum(this);photos.add(photo)}
IDM.Album.s_cache[cacheKey]=photos.clone()}
return photos},equals:function(album){return this.m_id==album.getId()}}});IDM.AlbumPhoto=Class.define
({ctor:function(){this.m_id=null;this.m_album=null;this.m_title=null;this.m_width=null;this.m_height=null;this.m_fileSize=null;this.m_date=null;this.m_fmtDate=null;this.m_previews=[];this.m_source=null},static:{createListFromXML:function(node){var photoNodes=XMLUtils.getChildrenByTagName(node,"photo");var res=new ArrayList();for(var i=0,n=photoNodes.length;i<n;++i){var photo=IDM.AlbumPhoto.createFromXML(photoNodes[i]);if(photo==null)
return null;res.add(photo)}
return res},createFromXML:function(node){var photo=new IDM.AlbumPhoto();if(!photo.readFromXML(node))
return null;return photo},sortPhotosCriteriaForFujiPrinting:function(a,b){return a.getId()-b.getId()},getById:function(photoId){var websURL=new URL("/modules/photo/_services/get-photo.php").addParam("photoId",photoId);var webs=new IDM.WebService(websURL);if(webs.call()&&webs.isSuccess()){var dom=webs.getResult();var root=XMLUtils.getRootElement(dom);return IDM.AlbumPhoto.createFromXML(root)}}},prototype:{getId:function(){return this.m_id},getAlbum:function(){return this.m_album},setAlbum:function(album){this.m_album=album},getTitle:function(){return this.m_title},setTitle:function(title){this.m_title=title},getWidth:function(){return this.m_width},getHeight:function(){return this.m_height},getFileSize:function(){return this.m_fileSize},getDate:function(){return this.m_date},getFormattedDate:function(){return this.m_fmtDate},getPreview:function(size){return this.m_previews[size]},getSource:function(){return this.m_source},getRatio:function(){if(this.getHeight()>this.getWidth())
return this.getWidth()>0?this.getHeight()/this.getWidth():0;else
return this.getHeight()>0?this.getWidth()/this.getHeight():0},isLandscape:function(){return this.getWidth()>this.getHeight()},getCurrentDPI:function(photoZoom,itemSizeMm){var MM_PER_INCH=25.4;return Math.min
(((this.getWidth()*MM_PER_INCH)/photoZoom)/itemSizeMm.width,((this.getHeight()*MM_PER_INCH)/photoZoom)/itemSizeMm.height)},clone:function(){var clone=new IDM.AlbumPhoto();clone.m_id=this.m_id;clone.m_title=this.m_title;clone.m_width=this.m_width;clone.m_height=this.m_height;clone.m_fileSize=this.m_fileSize;clone.m_date=this.m_date;clone.m_previews=[];clone.m_source=this.m_source.clone();for(var it=0,n=this.m_previews.length;it<n;it++){clone.m_previews[it]=this.m_previews[it]}
return clone},readFromXML:function(node){this.m_id=parseInt(node.getAttribute("id"));this.m_title=node.getAttribute("title");this.m_width=parseInt(node.getAttribute("width"));this.m_height=parseInt(node.getAttribute("height"));this.m_fileSize=parseInt(node.getAttribute("filesize"));var previewsNode=XMLUtils.getChildByTagName(node,"previews");var previewNodes=XMLUtils.getChildrenByTagName(previewsNode,"preview");for(var i=0;i<previewNodes.length;++i){var previewNode=previewNodes[i];var size=previewNode.getAttribute("size");var source=previewNode.getAttribute("source");var preview=new IDM.AlbumPhoto.Preview(size,URL.parse(source));this.m_previews[size]=preview}
var dateNode=XMLUtils.getChildByTagName(node,"date");this.m_date=dateNode.getAttribute("epoch");this.m_fmtDate=XMLUtils.getElementText(dateNode);var sourceNode=XMLUtils.getChildByTagName(node,"source");this.m_source=IDM.AlbumPhoto.Source.createFromXML(sourceNode);return true},writeToXML:function(doc){var node=doc.createElement("photo");node.setAttribute("id",this.getId());node.setAttribute("title",this.getTitle());node.setAttribute("width",this.getWidth());node.setAttribute("height",this.getHeight());node.setAttribute("fileSize",this.getFileSize());node.setAttribute("date",this.getDate());return node},rotate:function(){var tmp=this.m_width;this.m_width=this.m_height;this.m_height=tmp;this._updatePreviews()},_updatePreviews:function(){for(p in this.m_previews)
this.m_previews[p].updateSource()},compareTo:function(other){return this.m_date-other.m_date},toDisplayableString:function(){return"<div style='float:left;'><img alt='"+this.m_title+"' src='"+this.getPreview(IDM.AlbumPhoto.Preview.SIZE_SMALLQ).getSource().toString()+"' /></div><div style='width:300px; position:relative; left:5px; top:-5px;'><table><tr><td>"+"Nom de la photo :"+"</td><td>"+"<strong>"+this.m_title+"</strong>"+"</td></tr><tr><td>"+"Hauteur de la photo :"+"</td><td>"+"<strong>"+this.m_height+" pixels</strong>"+"</td></tr><tr><td>"+"Largeur de la photo :"+"</td><td>"+"<strong>"+this.m_width+" pixels</strong>"+"</td></tr><tr><td>"+"Poids de la photo :"+"</td><td>"+"<strong>"+StringUtils.formatByteSize(this.m_fileSize)+"</strong>"+"</td></tr><tr><td>"+"Date de la photo :"+"</td><td>"+"<strong>"+this.m_fmtDate+"</strong>"+"</td></tr></table></div>"}}});IDM.AlbumPhoto.Source=Class.define
({ctor:function(){this.m_id="";this.m_name=""},static:{createFromXML:function(node){var source=new IDM.AlbumPhoto.Source();if(!source.readFromXML(node))
return null;return source}},prototype:{getId:function(){return this.m_id},getName:function(){return this.m_name},readFromXML:function(node){this.m_id=node.getAttribute("id");this.m_name=XMLUtils.getChildTextSafe(node,"name");return true}}});IDM.AlbumPhoto.Preview=Class.define
({ctor:function(size,source){this.m_size=size;this.m_source=source},static:{SIZE_SMALL:"small",SIZE_SMALLQ:"smallq",SIZE_MEDIUM:"medium"},prototype:{getSize:function(){return this.m_size},getSource:function(){return this.m_source},updateSource:function(){this.m_source=this.m_source.addParam("time",JSUtils.currentTimeMillis())}}});IDM.AlbumPhoto.InfoDialog=Class.define
({ctor:function(photo){IDM.AlbumPhoto.InfoDialog.baseConstructor.call(this);this.setTitle(photo.getTitle());this.setButtons([IDM.Dialog.Button.CLOSE]);this.m_photo=photo},inherits:IDM.Dialog,prototype:{_constructInner:function(contElt,boxElt){var imageSize=this.m_photo.getWidth()*this.m_photo.getHeight();var imageSizeStr=NumberUtils.formatNumber
(Math.round(imageSize/100000)/10,1,null,null,true,true);var introElt=document.createElement("p");boxElt.appendChild(introElt);HTMLUtils.setElementText(introElt,"Résolution : "+imageSizeStr+" Mégapixels");var maxSize=new Size(IDM.Configuration.getParam("image.medium.width"),IDM.Configuration.getParam("image.medium.height"));var size=maxSize;if(this.m_photo.getHeight()>=this.m_photo.getWidth()){var r=this.m_photo.getWidth()/this.m_photo.getHeight();size.width=Math.max(500,size.height*r)}else
{var r=this.m_photo.getHeight()/this.m_photo.getWidth();size.height=Math.round(size.width*r)}
var imgContElt=document.createElement("div");imgContElt.style.textAlign="center";imgContElt.style.lineHeight=size.height+"px";HTMLUtils.setElementSize(imgContElt,size);var imgElt=document.createElement("img");imgElt.className="preview-control";imgElt.align="absmiddle";imgElt.style.visibility="visible";imgElt.src=this.m_photo.getPreview(IDM.AlbumPhoto.Preview.SIZE_MEDIUM).getSource();imgContElt.appendChild(imgElt);boxElt.appendChild(imgContElt)}}});IDM.Product={};IDM.Product.Context=Class.define
({ctor:function(){this.m_font=IDM.Font.getDefault()},static:{create:function(){var ctx=new IDM.Product.Context();return ctx},createFromXML:function(node){var ctx=new IDM.Product.Context();if(!ctx.readFromXML(node))
return null;return ctx}},prototype:{getDefaultFont:function(){return this.m_font},readFromXML:function(node){var fontNode=XMLUtils.getChildByTagName(node,"default-font");if(fontNode!=null)
this.m_font=IDM.Font.fromString(XMLUtils.getElementText(fontNode));return true},writeToXML:function(dom){var node=dom.createElement("context");XMLUtils.setChildText(dom,node,"default-font",this.m_font.toString());return node}}});IDM.Product.Material=Class.define
({ctor:function(){this.m_id=null;this.m_code=null;this.m_name=null;this.m_optional=null;this.m_values=new ArrayList()},static:{createFromXML:function(node){var mat=new IDM.Product.Material();if(!mat.readFromXML(node))
return null;return mat}},prototype:{readFromXML:function(node){this.m_id=parseInt(node.getAttribute("id"));this.m_code=node.getAttribute("code");this.m_name=node.getAttribute("name");this.m_optional=(node.getAttribute("optional")=="true");var valueNodes=XMLUtils.getChildrenByTagName(node,"value");for(var i=0,n=valueNodes.length;i<n;++i){var value=IDM.Product.MaterialValue.createFromXML(valueNodes[i],this);if(value!=null)
this.m_values.add(value)}
return true},getId:function(){return this.m_id},getCode:function(){return this.m_code},getName:function(){return this.m_name},isOptional:function(){return this.m_optional},getValues:function(){return this.m_values},getDefaultValue:function(){for(var i=0,n=this.m_values.getCount();i<n;++i){var val=this.m_values.getAt(i);if(val.isDefault())
return val}
return null},getValueById:function(id){for(var i=0,n=this.m_values.getCount();i<n;++i){var val=this.m_values.getAt(i);if(val.getId()==id)
return val}
return null}}});IDM.Product.MaterialValue=Class.define
({ctor:function(){this.m_material=null;this.m_id=null;this.m_code=null;this.m_name=null;this.m_image=null;this.m_default=null},static:{createFromXML:function(node,material){var val=new IDM.Product.MaterialValue();val.m_material=material;if(!val.readFromXML(node))
return null;return val}},prototype:{readFromXML:function(node){this.m_id=parseInt(node.getAttribute("id"));this.m_code=node.getAttribute("code");this.m_name=node.getAttribute("name");this.m_image=XMLUtils.getChildText(node,"image");this.m_default=(node.getAttribute("default")=="true");return true},getMaterial:function(){return this.m_material},getId:function(){return this.m_id},getCode:function(){return this.m_code},getName:function(){return this.m_name},getImage:function(){return this.m_image},isDefault:function(){return this.m_default}}});IDM.Product.Paper=Class.define
({ctor:function(){this.m_id=null;this.m_name=null;this.m_default=null;this.m_force=null},static:{createFromXML:function(node){var paper=new IDM.Product.Paper();if(!paper.readFromXML(node))
return null;return paper}},prototype:{readFromXML:function(node){this.m_id=parseInt(node.getAttribute("id"));this.m_name=node.getAttribute("name");this.m_default=(node.getAttribute("default")=="true");this.m_force=(node.getAttribute("force")=="true");return true},getId:function(){return this.m_id},getName:function(){return this.m_name},isDefault:function(){return this.m_default},isForced:function(){return this.m_force}}});IDM.Product.ImageEffectList=Class.define
({ctor:function(){ArrayList.call(this)},inherits:ArrayList,static:{createFromXML:function(node){var effectNodes=XMLUtils.getChildrenElements(node);var list=new IDM.Product.ImageEffectList();for(var i=0,n=effectNodes.length;i<n;++i){var effect=IDM.Product.ImageEffect.createFromXML(effectNodes[i]);if(effect!=null)
list.add(effect)}
return list}},prototype:{writeToXML:function(doc){var node=doc.createElement("effects");for(var i=0,n=this.getCount();i<n;++i)
node.appendChild(this.getAt(i).writeToXML(doc));return node},clone:function(){var newList=new IDM.Product.ImageEffectList();for(var i=0,n=this.getCount();i<n;++i)
newList.add(this.getAt(i).clone());return newList},reset:function(){this.removeAll()},addEffect:function(effect){this.removeEffect(effect);this.add(effect)},removeEffect:function(effect){this.removeIf
(function(elt){return elt.getId()==effect.getId()})},hasEffect:function(effect){for(var i=0,n=this.getCount();i<n;++i){if(this.getAt(i).getId()==effect.getId())
return true}
return false},getEffectById:function(effectId){for(var i=0,n=this.getCount();i<n;++i){if(this.getAt(i).getId()==effectId)
return this.getAt(i)}
return null},toURLParam:function(){var res="";for(var i=0,n=this.getCount();i<n;++i){if(i!=0)
res+="|";res+=this.getAt(i).toURLParam()}
return StringUtils.encodeBase64(res)}}});IDM.Product.ImageEffect=Class.define
({ctor:function(){},static:{getDefaultImage:function(){return"/styles/default/images/products/common/imgeffect-none.png"},createFromXML:function(node){var id=node.getAttribute("id");var effect=IDM.Product.ImageEffectFactory.create(id);if(effect==null)return null;var paramNodes=XMLUtils.getChildrenElements(node);var params=[];for(var i=0;i<paramNodes.length;++i){var paramNode=paramNodes[i];params[paramNode.tagName]=XMLUtils.getElementText(paramNode)}
effect.setParams(params);return effect}},prototype:{getId:function(){return null},getName:function(){return null},getImage:function(){return"/styles/default/images/products/common/imgeffect-"+this.getId()+".png"},getParams:function(){return[]},setParams:function(params){},clone:function(){var effect=IDM.Product.ImageEffectFactory.create(this.getId());if(effect==null)return null;effect.copyFrom(this);return effect},toURLParam:function(){var res=this.getId();var params=this.getParams();for(p in params)
res+=";"+URL.escape(p)+"="+URL.escape(JSUtils.toString(params[p]));return res},writeToXML:function(doc){var node=doc.createElement("effect");node.setAttribute("id",this.getId());var params=this.getParams();for(p in params)
XMLUtils.setChildText(doc,node,p,JSUtils.toString(params[p]));return node},copyFrom:function(other){this.setParams(other.getParams())},getConfigFrame:function(refreshCallback){var contElt=document.createElement("div");var p=document.createElement("p");p.appendChild(document.createTextNode("Ce filtre ne dispose d'aucun paramètre."));contElt.appendChild(p);return contElt}}});IDM.Product.ImageEffectFactory=Class.define
({static:{s_types:new Array(),register:function(type,className){IDM.Product.ImageEffectFactory.s_types[type]=className},create:function(type){var className=IDM.Product.ImageEffectFactory.s_types[type];if(!className)return null;var filter=null;eval("filter = new "+className+"();");return filter},enumEffects:function(){var res=new ArrayList();for(t in IDM.Product.ImageEffectFactory.s_types)
res.add(IDM.Product.ImageEffectFactory.create(t));return res}}});IDM.Product.NegateImageEffect=Class.define
({inherits:IDM.Product.ImageEffect,prototype:{getId:function(){return"negate"},getName:function(){return"Négatif"}}});IDM.Product.ImageEffectFactory.register("negate","IDM.Product.NegateImageEffect");IDM.Product.SepiaImageEffect=Class.define
({inherits:IDM.Product.ImageEffect,prototype:{getId:function(){return"sepia"},getName:function(){return"Sépia"}}});IDM.Product.ImageEffectFactory.register("sepia","IDM.Product.SepiaImageEffect");IDM.Product.GrayscaleImageEffect=Class.define
({inherits:IDM.Product.ImageEffect,prototype:{getId:function(){return"grayscale"},getName:function(){return"Noir et blanc"}}});IDM.Product.ImageEffectFactory.register("grayscale","IDM.Product.GrayscaleImageEffect");IDM.Product.BlurImageEffect=Class.define
({ctor:function(){this.m_radius=5;this.m_sigma=3},inherits:IDM.Product.ImageEffect,prototype:{getId:function(){return"blur"},getName:function(){return"Flou"},getParams:function(){var params=new Array();params["radius"]=NumberUtils.formatFloat(this.m_radius);params["sigma"]=NumberUtils.formatFloat(this.m_sigma);return params},setParams:function(params){this.m_radius=Math.max(1,NumberUtils.parseNumberSafe(params["radius"]));this.m_sigma=Math.max(1,NumberUtils.parseNumberSafe(params["sigma"]))},getConfigFrame:function(refreshCallback){var contElt=document.createElement("div");var p=document.createElement("p");contElt.appendChild(p);var inputElt=document.createElement("input");inputElt.className="input-control";inputElt.size=5;inputElt.value=NumberUtils.formatNumber(this.m_radius,0);inputElt.onblur=inputElt.onchange=IDM.Product.BlurImageEffect._onConfigFrameRadiusChanged;inputElt.m_filter=this;inputElt.m_callback=refreshCallback;var labelElt=HTMLUtils.createLabel(inputElt,"Rayon : ");p.appendChild(labelElt);p.appendChild(inputElt);p.appendChild(document.createTextNode(" pixels"));p=document.createElement("p");contElt.appendChild(p);inputElt=document.createElement("input");inputElt.className="input-control";inputElt.size=5;inputElt.value=NumberUtils.formatNumber(this.m_sigma,1);inputElt.onblur=inputElt.onchange=IDM.Product.BlurImageEffect._onConfigFrameSigmaChanged;inputElt.m_filter=this;inputElt.m_callback=refreshCallback;labelElt=HTMLUtils.createLabel(inputElt,"Écart-type : ");p.appendChild(labelElt);p.appendChild(inputElt);return contElt},_onConfigFrameRadiusChanged:function(){var filter=this.m_filter;var callback=this.m_callback;var radiusVal=NumberUtils.parseNumberSafe(this.value);if(radiusVal!=filter.m_radius){filter.m_radius=radiusVal;callback()}},_onConfigFrameSigmaChanged:function(){var filter=this.m_filter;var callback=this.m_callback;var sigmaVal=NumberUtils.parseNumberSafe(this.value);if(sigmaVal!=filter.m_sigma){filter.m_sigma=sigmaVal;callback()}}}});IDM.Product.ImageEffectFactory.register("blur","IDM.Product.BlurImageEffect");IDM.Product.MosaicImageEffect=Class.define
({ctor:function(){this.m_size=87},inherits:IDM.Product.ImageEffect,prototype:{getId:function(){return"mosaic"},getName:function(){return"Mosaïque"},getParams:function(){var params=new Array();params["size"]=NumberUtils.formatFloat(this.m_size);return params},setParams:function(params){this.m_size=Math.min(100,Math.max(1,NumberUtils.parseNumberSafe(params["size"])))},getConfigFrame:function(refreshCallback){var contElt=document.createElement("div");var p=document.createElement("p");p.appendChild(document.createTextNode("Taille des blocs :"));contElt.appendChild(p);var sizes=[["Petit",70],["Moyen",87],["Grand",93]];var groupId=HTMLUtils.generateUniqueId();p=document.createElement("p");contElt.appendChild(p);for(var i=0;i<sizes.length;++i){var radioElt=HTMLUtils.createRadioWithLabel(groupId,sizes[i][0]);radioElt[1].checked=radioElt[1].defaultChecked=(this.m_size==sizes[i][1]);radioElt[1].onchange=radioElt[1].onclick=JSUtils.makeCallback
(this,IDM.Product.MosaicImageEffect.prototype._onConfigFrameBlockSizeRadioClicked,sizes[i][1],refreshCallback);p.appendChild(radioElt[0]);p.appendChild(document.createElement("br"))}
return contElt},_onConfigFrameBlockSizeRadioClicked:function(size,callback){if(this.m_size!=size){this.m_size=size;callback()}}}});IDM.Product.ImageEffectFactory.register("mosaic","IDM.Product.MosaicImageEffect");IDM.Product.SwirlImageEffect=Class.define
({ctor:function(){this.m_degrees=180},inherits:IDM.Product.ImageEffect,prototype:{getId:function(){return"swirl"},getName:function(){return"Tourbillon"},getParams:function(){var params=new Array();params["degrees"]=this.m_degrees;return params},setParams:function(params){this.m_degrees=parseInt(params["degrees"])},getConfigFrame:function(refreshCallback){var contElt=document.createElement("div");var p=document.createElement("p");p.appendChild(document.createTextNode("Intensité de l'effet : "));contElt.appendChild(p);var degrees=[[30,"Très faible (30°)"],[60,"Faible (60°)"],[120,"Moyenne (120°)"],[180,"Forte (180°)"],[240,"Très forte (240°)"]];var selectElt=document.createElement("select");for(var i=0,n=degrees.length;i<n;++i){selectElt.options[i]=new Option(degrees[i][1],degrees[i][0],this.m_degrees==degrees[i][0])}
p.appendChild(selectElt);selectElt.onkeyup=selectElt.onclick=selectElt.onchange=JSUtils.makeCallback
(this,IDM.Product.SwirlImageEffect.prototype._onDegreesChanged,NodeRef.create(selectElt),refreshCallback);return contElt},_onDegreesChanged:function(selectElt,callback){var degrees=Math.max(0,Math.min(360,selectElt.getElement().value));if(this.m_degrees!=degrees){this.m_degrees=degrees;callback()}}}});IDM.Product.ImageEffectFactory.register("swirl","IDM.Product.SwirlImageEffect");IDM.Product.EmbossImageEffect=Class.define
({ctor:function(){},inherits:IDM.Product.ImageEffect,prototype:{getId:function(){return"emboss"},getName:function(){return"Relief"}}});IDM.Product.ImageEffectFactory.register("emboss","IDM.Product.EmbossImageEffect");IDM.Product.WaterColorImageEffect=Class.define
({ctor:function(){},inherits:IDM.Product.ImageEffect,prototype:{getId:function(){return"watercolor"},getName:function(){return"Aquarelle"}}});IDM.Product.ImageEffectFactory.register("watercolor","IDM.Product.WaterColorImageEffect");IDM.Product.SketchyImageEffect=Class.define
({ctor:function(){},inherits:IDM.Product.ImageEffect,prototype:{getId:function(){return"sketchy"},getName:function(){return"Tracé au crayon"}}});IDM.Product.OilPaintImageEffect=Class.define
({ctor:function(){this.m_size=0.00600},inherits:IDM.Product.ImageEffect,prototype:{getId:function(){return"oilpaint"},getName:function(){return"Peinture à l'huile"},getParams:function(){var params=new Array();params["size"]=NumberUtils.formatFloat(this.m_size);return params},setParams:function(params){this.m_size=NumberUtils.parseNumberSafe(params["size"])},getConfigFrame:function(refreshCallback){var contElt=document.createElement("div");var p=document.createElement("p");p.appendChild(document.createTextNode("Taille du pinceau :"));contElt.appendChild(p);var sizes=[["Très petit",0.00300],["Petit",0.00600],["Moyen",0.00900],["Grand",0.01200]];var groupId=HTMLUtils.generateUniqueId();p=document.createElement("p");contElt.appendChild(p);for(var i=0;i<sizes.length;++i){var radioElt=HTMLUtils.createRadioWithLabel(groupId,sizes[i][0]);radioElt[1].checked=radioElt[1].defaultChecked=(this.m_size==sizes[i][1]);radioElt[1].onchange=radioElt[1].onclick=JSUtils.makeCallback
(this,IDM.Product.OilPaintImageEffect.prototype._onConfigFrameBrushSizeRadioClicked,sizes[i][1],refreshCallback);p.appendChild(radioElt[0]);p.appendChild(document.createElement("br"))}
return contElt},_onConfigFrameBrushSizeRadioClicked:function(size,callback){if(this.m_size!=size){this.m_size=size;callback()}}}});IDM.Product.ImageEffectFactory.register("oilpaint","IDM.Product.OilPaintImageEffect");IDM.Product.HFlipImageEffect=Class.define
({ctor:function(){},inherits:IDM.Product.ImageEffect,prototype:{getId:function(){return"hflip"},getName:function(){return"Miroir"}}});IDM.Product.ImageEffectFactory.register("hflip","IDM.Product.HFlipImageEffect");IDM.Product.VFlipImageEffect=Class.define
({ctor:function(){},inherits:IDM.Product.ImageEffect,prototype:{getId:function(){return"vflip"},getName:function(){return"Miroir vertical"}}});IDM.Product.ImageEffectFactory.register("vflip","IDM.Product.VFlipImageEffect");IDM.Product.ColorizeImageEffect=Class.define
({ctor:function(){this.m_color=new Color(50,180,30)},inherits:IDM.Product.ImageEffect,prototype:{getId:function(){return"colorize"},getName:function(){return"Teinte"},getParams:function(){var params=new Array();params["color"]=this.m_color.toHex();return params},setParams:function(params){this.m_color=Color.fromHex(params["color"])},getConfigFrame:function(refreshCallback){var contElt=document.createElement("div");var p=document.createElement("p");contElt.appendChild(p);var colorChooser=new IDM.ColorChooser();colorChooser.setColor(this.m_color);colorChooser.getNamedSlot("color-changed").attach
(JSUtils.makeCallback(this,IDM.Product.ColorizeImageEffect.prototype._onConfigFrameColorChanged,refreshCallback));p.appendChild(document.createTextNode("Couleur : "));p.appendChild(colorChooser.getHTMLElement());return contElt},_onConfigFrameColorChanged:function(callback,slot,color){if(!this.m_color.equals(color)){this.m_color=color;callback()}}}});IDM.Product.ImageEffectFactory.register("colorize","IDM.Product.ColorizeImageEffect");IDM.Product.ColorInImageEffect=Class.define
({ctor:function(){},inherits:IDM.Product.ImageEffect,prototype:{getId:function(){return"colorin"},getName:function(){return"Contours"}}});IDM.Product.ImageEffectFactory.register("colorin","IDM.Product.ColorInImageEffect");IDM.Product.PopArtImageEffect=Class.define
({ctor:function(){this.m_palette=0},inherits:IDM.Product.ImageEffect,prototype:{getId:function(){return"popart"},getName:function(){return"Pop Art"},getParams:function(){var params=new Array();params["palette"]=this.m_palette;return params},setParams:function(params){this.m_palette=parseInt(params["palette"])},getConfigFrame:function(refreshCallback){var contElt=document.createElement("div");var p=document.createElement("p");p.appendChild(document.createTextNode("Palette de couleurs : "));contElt.appendChild(p);var palettes=["Bleu / jaune / vert","Orange / jaune pâle / vert","Rose / marron / orange","Bleu / violet","Bleu / orange / violet","Rose / bleu / orange","Marron / orange / jaune pâle","Jaune / bleu / rose","Rouge / orange / jaune pâle","Bleu / bleu clair / vert pâle"];var selectElt=document.createElement("select");for(var i=0;i<palettes.length;++i)
selectElt.options[i]=new Option(palettes[i],i,this.m_palette==i);p.appendChild(selectElt);selectElt.onkeyup=selectElt.onclick=selectElt.onchange=JSUtils.makeCallback
(this,IDM.Product.PopArtImageEffect.prototype._onPaletteChanged,NodeRef.create(selectElt),refreshCallback);p=document.createElement("p");HTMLUtils.setElementText(p,"Astuce : pour un meilleur rendu, utilisez une photo"
+" avec un sujet (visage) qui se détache bien du fond (fond uni).");contElt.appendChild(p);return contElt},_onPaletteChanged:function(selectElt,callback){var palette=selectElt.getElement().value;if(this.m_palette!=palette){this.m_palette=palette;callback()}}}});IDM.Product.ImageEffectFactory.register("popart","IDM.Product.PopArtImageEffect");IDM.Product.Action=Class.define
({ctor:function(){},prototype:{fire:function(){}}});IDM.Product.EditTextAction=Class.define
({ctor:function(elt,callback){this.m_elt=elt;this.m_callback=callback;this.m_editor=null;this.m_focusLayer=null},inherits:IDM.Product.Action,static:{Callback:Class.define
({ctor:function(){},prototype:{getCurrentText:function(){},setNewText:function(text){}}}),_onBlurEditor:function(){var action=this.m_action;if(action.m_editor){var elt=action.m_editor.getElement();elt.parentNode.removeChild(elt);try{action.m_callback.setNewText(elt.value)}catch(e){}
var layer=action.m_focusLayer.getElement();layer.parentNode.removeChild(layer);action.m_editor=null;action.m_focusLayer=null}
DOMEventUtils.resetDefaultEventCapture(this)}},prototype:{fire:function(){DOMEventUtils.setupDefaultEventCapture(this);var focusLayer=document.createElement("div");focusLayer.style.position="absolute";HTMLUtils.setElementPos(focusLayer,new Point(0,0));HTMLUtils.setElementSize(focusLayer,HTMLUtils.getDocumentSize());focusLayer.onmousedown=IDM.Product.EditTextAction._onBlurEditor;focusLayer.m_action=this;document.body.appendChild(focusLayer);var elt=document.createElement("textarea");elt.style.position="absolute";elt.style.border="1px solid #606060";elt.style.backgroundColor="#ffffff";elt.style.fontFamily="sans-serif";elt.style.fontSize="8pt";elt.value=this.m_callback.getCurrentText();elt.onblur=IDM.Product.EditTextAction._onBlurEditor;elt.m_action=this;var itemElt=this.m_elt;var size=HTMLUtils.getElementSize(itemElt);var pos=HTMLUtils.getElementPos(itemElt);size.width=Math.max(size.width,200);size.height=Math.max(size.height,40);HTMLUtils.setElementPos(elt,pos);HTMLUtils.setElementSize(elt,size);document.body.appendChild(elt);elt.focus();this.m_focusLayer=NodeRef.create(focusLayer);this.m_editor=NodeRef.create(elt)}}});IDM.Product.Item=Class.define
({ctor:function(){},prototype:{getActions:function(){return new ArrayList()}}});IDM.Product.Item.Action=Class.define
({ctor:function(){},prototype:{getId:function(){return null},getName:function(){return null},getTooltip:function(){return this.getName()},getDescription:function(){return null},fire:function(){}}});IDM.Product.Item.FrameAction=Class.define
({ctor:function(){IDM.Product.Item.FrameAction.baseConstructor.call(this)},inherits:IDM.Product.Item.Action,prototype:{getId:function(){return"frame"},getName:function(){return"Encadrement"},getDescription:function(){return"Vous pouvez ajouter un cadre autour de votre photo."}}});IDM.Product.Item.ReframeAction=Class.define
({ctor:function(){IDM.Product.Item.ReframeAction.baseConstructor.call(this)},inherits:IDM.Product.Item.Action,prototype:{getId:function(){return"reframe"},getName:function(){return"Recadrage"},getDescription:function(){return"Vous pouvez zoomer et recadrer votre image dans la zone."}}});IDM.Product.Item.CaptionAction=Class.define
({ctor:function(){IDM.Product.Item.CaptionAction.baseConstructor.call(this)},inherits:IDM.Product.Item.Action,prototype:{getId:function(){return"caption"},getName:function(){return"Légende"},getDescription:function(){return"Vous pouvez ajouter une légende sous votre image."}}});IDM.Product.Item.ImageFXAction=Class.define
({ctor:function(){IDM.Product.Item.ImageFXAction.baseConstructor.call(this)},inherits:IDM.Product.Item.Action,prototype:{getId:function(){return"imagefx"},getName:function(){return"Effets"},getDescription:function(){return"Appliquez des effets spéciaux sur votre image."}}});IDM.Product.Item.EventsAction=Class.define
({ctor:function(){IDM.Product.Item.EventsAction.baseConstructor.call(this)},inherits:IDM.Product.Item.Action,prototype:{getId:function(){return"events"},getName:function(){return"Évènements"},getDescription:function(){return"Ajoutez des textes ou des images sur certaines dates."}}});IDM.Product.Item.TextAlignmentAction=Class.define
({ctor:function(){IDM.Product.Item.TextAlignmentAction.baseConstructor.call(this)},inherits:IDM.Product.Item.Action,prototype:{getId:function(){return"textalign"},getName:function(){return"Alignment"},getDescription:function(){return"Changez la position du texte."}}});IDM.Product.Item.TextStyleAction=Class.define
({ctor:function(){IDM.Product.Item.TextStyleAction.baseConstructor.call(this)},inherits:IDM.Product.Item.Action,prototype:{getId:function(){return"textstyle"},getName:function(){return"Style du texte"},getDescription:function(){return"Changez le style d'écriture."}}});IDM.Product.Item.StyleAction=Class.define
({ctor:function(){IDM.Product.Item.StyleAction.baseConstructor.call(this)},inherits:IDM.Product.Item.Action,prototype:{getId:function(){return"style"},getName:function(){return"Style"},getDescription:function(){return"Changez les couleurs ou le style."}}});IDM.Product.Item.RemoveImageAction=Class.define
({ctor:function(){IDM.Product.Item.RemoveImageAction.baseConstructor.call(this)},inherits:IDM.Product.Item.Action,prototype:{getId:function(){return"removeimage"},getName:function(){return"Pas d'image."},getDescription:function(){return"Retirez l'image de cette zone."}}});IDM.Product.Item.RotateAction=Class.define
({ctor:function(){IDM.Product.Item.Action.call(this)},inherits:IDM.Product.Item.Action,prototype:{getId:function(){return"rotate"},getName:function(){return"Rotation"},getDescription:function(){return"Rotation de l'image de 90°"}}});IDM.Product.Selection=Class.define
({ctor:function(){IDM.Product.Selection.baseConstructor.call(this);this.declareSlot("item-selected");this.declareSlot("item-unselected");this.m_elts=null;this.m_handles=null;this.m_actionsElt=null;this.m_thickness=IDM.Product.Selection.THICKNESS;this.m_selItem=null},inherits:IDM.Object,static:{THICKNESS:5},prototype:{_init:function(){if(this.m_elts!=null)
return;this.m_elts=[];this.m_handles=[];var container=this._getContainerElement();for(var i=0;i<4;++i){var elt=document.createElement("div");elt.className="idm-product-selection-rect";elt.style.position="absolute";elt.style.display="none";HTMLUtils.setupLineDiv(elt);container.appendChild(elt);this.m_elts[i]=NodeRef.create(elt)}
for(var i=0;i<4;++i){var elt=document.createElement("div");elt.className="idm-product-selection-handle";elt.style.position="absolute";elt.style.display="none";HTMLUtils.setElementSize(elt,new Size(this.m_thickness-2,this.m_thickness-2));HTMLUtils.setupLineDiv(elt);container.appendChild(elt);this.m_handles[i]=NodeRef.create(elt)}},getCurrentItem:function(){return this.m_selItem},reset:function(){if(this.m_elts==null)
return;var selItem=this.m_selItem;this.m_selItem=null;this._update();if(selItem!=null)
this._onItemUnselected(selItem)},update:function(){this._update()},select:function(item){if(this.m_selItem==item)
return;if(item==null){this.reset();return}
var previousSelItem=this.m_selItem;this.m_selItem=item;if(previousSelItem!=null)
this._onItemUnselected(previousSelItem);this._update();this._onItemSelected(item)},_getContainerElement:function(){return document.body},_getBoundingElement:function(){return this._getContainerElement()},_onItemSelected:function(item){this.getNamedSlot("item-selected").trigger(item)},_onItemUnselected:function(item){this.getNamedSlot("item-unselected").trigger(item)},_getItemRect:function(item){return new Rect(0,0,0,0)},_update:function(){this._init();if(this.m_actionsElt!=null){var elt=this.m_actionsElt.getElement();elt.parentNode.removeChild(elt);this.m_actionsElt=null}
if(this.m_selItem==null){for(var i=0;i<4;++i){this.m_elts[i].getElement().style.display="none";this.m_handles[i].getElement().style.display="none"}}else
{var rect=this._getItemRect(this.m_selItem);this._moveRect(rect.x1,rect.y1,rect.x2,rect.y2);this.m_actionsElt=this._createActionsContainer()}},_moveRect:function(x1,y1,x2,y2){var cont=this._getContainerElement();var contSize=HTMLUtils.getElementSize(cont);x1-=1;y1-=1;x2+=1;y2+=1;x1=Math.round(Math.max(0,x1));y1=Math.round(Math.max(0,y1));x2=Math.round(Math.min(contSize.width-2,x2));y2=Math.round(Math.min(contSize.height-2,y2));var elt0=this.m_elts[0].getElement();elt0.style.left=x1+"px";elt0.style.top=y1+"px";elt0.style.width=this.m_thickness+"px";elt0.style.height=(y2-y1)+"px";elt0.style.display="block";var handle0=this.m_handles[0].getElement();HTMLUtils.setElementPos(handle0,new Point(x1,y1));HTMLUtils.setElementDisplay(handle0,true);var elt1=this.m_elts[1].getElement();elt1.style.left=(x1+this.m_thickness)+"px";elt1.style.top=y1+"px";elt1.style.width=(x2-x1-2*this.m_thickness)+"px";elt1.style.height=this.m_thickness+"px";elt1.style.display="block";var handle1=this.m_handles[1].getElement();HTMLUtils.setElementPos(handle1,new Point(x2-this.m_thickness,y1));HTMLUtils.setElementDisplay(handle1,true);var elt2=this.m_elts[2].getElement();elt2.style.left=(x2-this.m_thickness)+"px";elt2.style.top=y1+"px";elt2.style.width=this.m_thickness+"px";elt2.style.height=(y2-y1)+"px";elt2.style.display="block";var handle2=this.m_handles[2].getElement();HTMLUtils.setElementPos(handle2,new Point(x2-this.m_thickness,y2-this.m_thickness));HTMLUtils.setElementDisplay(handle2,true);var elt3=this.m_elts[3].getElement();elt3.style.left=(x1+this.m_thickness)+"px";elt3.style.top=(y2-this.m_thickness)+"px";elt3.style.width=(x2-x1-2*this.m_thickness)+"px";elt3.style.height=this.m_thickness+"px";elt3.style.display="block";var handle3=this.m_handles[3].getElement();HTMLUtils.setElementPos(handle3,new Point(x1,y2-this.m_thickness));HTMLUtils.setElementDisplay(handle3,true)},_createActionsContainer:function(){var actions=this.m_selItem.getActions();if(actions.isEmpty())
return null;var actionsElt=document.createElement("div");actionsElt.className="idm-product-selection-actions";actionsElt.style.position="absolute";actionsElt.style.left=actionsElt.style.top="-5000px";actionsElt.style.fontSize="1px";document.body.appendChild(actionsElt);var totalWidth=0;var maxHeight=0;for(var i=0,n=actions.getCount();i<n;++i){var action=actions.getAt(i);var actionElt=this._createActionButton(action,i,n);actionsElt.appendChild(actionElt);var actionSize=HTMLUtils.getElementSize(actionElt);totalWidth+=actionSize.width;maxHeight=Math.max(maxHeight,actionSize.height)}
var scrollPos=HTMLUtils.getScrollPos();var winSize=HTMLUtils.getWindowInnerSize();var contElt=this._getContainerElement();var contPos=HTMLUtils.getElementPos(contElt);var rect=this._getItemRect(this.m_selItem);var pos=new Point(contPos.x+rect.x2-totalWidth-10,contPos.y+rect.y2+10);var size=new Size(totalWidth,maxHeight);winSize.width+=scrollPos.x
if(pos.x<scrollPos.x)pos.x=scrollPos.x;if(pos.x+size.width>winSize.width)pos.x=winSize.width-size.width;HTMLUtils.setElementSize(actionsElt,size);HTMLUtils.setElementPos(actionsElt,pos);return NodeRef.create(actionsElt)},_createActionButton:function(action,index,count){var elt=document.createElement("div");elt.className="idm-product-selection-action "+action.getId()
+(index==0?" first":"")+(index==(count-1)?" last":"");elt.onclick=JSUtils.makeCallbackEvent(this,IDM.Product.Selection.prototype._onClickedAction,action);if(action.getDescription())
elt.title=action.getTooltip()+" : "+action.getDescription();else
elt.title=action.getTooltip();return elt},_onClickedAction:function(action,ev){DOMEventUtils.stopPropagation(ev);action.fire();return false}}});IDM.Product.OptionsDialog=Class.define
({ctor:function(){IDM.Product.OptionsDialog.baseConstructor.call(this);this.setButtons([IDM.Dialog.Button.OK,IDM.Dialog.Button.CANCEL]);this.m_paperChoice=null;this.m_paperById=[];this.m_localeChoice=null;this.m_materials=null;this.m_matGroups=[]},inherits:IDM.Dialog,prototype:{_constructInner:function(contElt,boxElt){var papers=this._getPapers();var curPaper=this._getCurrentPaper();if(papers.getCount()>1&&curPaper!=null){var paperFrame=document.createElement("fieldset");var legend=document.createElement("legend");legend.appendChild(document.createTextNode("Papier"));paperFrame.appendChild(legend);boxElt.appendChild(paperFrame);var paperChoice=new ChoiceBox();paperChoice.setStandalone(true);paperChoice.getHTMLElement().style.position="relative";paperChoice.getHTMLElement().className="select-control";var p=document.createElement("p");paperFrame.appendChild(p);p.innerHTML="Choisissez le papier qui sera utilisé pour l'impression<br/>de votre produit.";p=document.createElement("p");paperFrame.appendChild(p);p.appendChild(document.createTextNode("Papier : "));p.appendChild(paperChoice.getHTMLElement());var items=new ArrayList();for(var i=0,n=papers.getCount();i<n;++i){var paper=papers.getAt(i);this.m_paperById[paper.getId()]=paper;var item=new ChoiceBox.Item(paper.getName(),paper.getId());items.add(item)}
paperChoice.setItems(items);paperChoice.setSelectedValue(curPaper.getId());this.m_paperChoice=paperChoice}else
{this.m_paperChoice=null}
var locales=this._getLocales();var localeCount=0;for(lid in locales)
localeCount++;if(localeCount>1){var localeFrame=document.createElement("fieldset");var legend=document.createElement("legend");legend.appendChild(document.createTextNode("Langue et région"));localeFrame.appendChild(legend);boxElt.appendChild(localeFrame);var localeChoice=new ChoiceBox();localeChoice.setStandalone(true);localeChoice.getHTMLElement().style.position="relative";localeChoice.getHTMLElement().className="select-control";var p=document.createElement("p");localeFrame.appendChild(p);p.innerHTML="Certains éléments du produit (comme les dates) peuvent dépendre<br/>"
+"d'une langue ou d'une région ; vous pouvez la spécifier ici.";p=document.createElement("p");localeFrame.appendChild(p);p.appendChild(document.createTextNode("Langue : "));p.appendChild(localeChoice.getHTMLElement());var items=new ArrayList();for(lid in locales){var item=new ChoiceBox.Item(locales[lid],lid);items.add(item)}
localeChoice.setItems(items);localeChoice.setSelectedValue(this._getCurrentLocale());this.m_localeChoice=localeChoice}else
{this.m_localeChoice=null}
var materials=this._getMaterials();this.m_materials=materials.clone();this.m_matGroups=[];for(var i=0,n=materials.getCount();i<n;++i){var mat=materials.getAt(i);var values=mat.getValues();if(mat.isOptional()||values.getCount()>1){var matFrame=document.createElement("fieldset");var legend=document.createElement("legend");legend.appendChild(document.createTextNode(mat.getName()));matFrame.appendChild(legend);boxElt.appendChild(matFrame);var curValue=this._getCurrentMaterialValue(mat);if(curValue==null&&!mat.isOptional())
curValue=this._getDefaultMaterialValue(mat);if(mat.isOptional()&&values.getCount()==1){var value=values.getAt(0);var checkElt=document.createElement("input");checkElt.type="checkbox";checkElt.defaultChecked=checkElt.checked=(curValue!=null&&value.getId()==curValue.getId());checkElt.id=HTMLUtils.generateUniqueId();checkElt.className="clickable-control";checkElt.m_value=value;var labelElt=document.createElement("label");labelElt.htmlFor=checkElt.id;labelElt.appendChild(document.createTextNode(" "+value.getName()));labelElt.className="clickable-control";matFrame.appendChild(checkElt);matFrame.appendChild(document.createTextNode(" "));matFrame.appendChild(labelElt);this.m_matGroups[mat.getId()]=checkElt}else
{var groupName=HTMLUtils.generateUniqueId();var group=[];if(mat.isOptional()){var radioElt=null;if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_IE){var tmp=document.createElement("div");tmp.innerHTML='<input type="radio" name="'+groupName+'"/>';radioElt=tmp.childNodes[0];tmp=null}else
{radioElt=document.createElement("input");radioElt.type="radio";radioElt.name=groupName}
radioElt.defaultChecked=radioElt.checked=(curValue==null);radioElt.id=HTMLUtils.generateUniqueId();radioElt.className="clickable-control";radioElt.m_value=null;var labelElt=document.createElement("label");labelElt.htmlFor=radioElt.id;labelElt.appendChild(document.createTextNode("Pas de "+mat.getName()));labelElt.className="clickable-control";matFrame.appendChild(radioElt);matFrame.appendChild(document.createTextNode(" "));matFrame.appendChild(labelElt);matFrame.appendChild(document.createElement("br"))}
for(var j=0,p=values.getCount();j<p;++j){var value=values.getAt(j);var radioElt=null;if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_IE){var tmp=document.createElement("div");tmp.innerHTML='<input type="radio" name="'+groupName+'"/>';radioElt=tmp.childNodes[0];tmp=null}else
{radioElt=document.createElement("input");radioElt.type="radio";radioElt.name=groupName}
radioElt.defaultChecked=radioElt.checked=(curValue!=null&&value.getId()==curValue.getId());radioElt.id=HTMLUtils.generateUniqueId();radioElt.className="clickable-control";radioElt.m_value=value;var labelElt=document.createElement("label");labelElt.htmlFor=radioElt.id;labelElt.appendChild(document.createTextNode(" "+value.getName()));labelElt.className="clickable-control";matFrame.appendChild(radioElt);matFrame.appendChild(document.createTextNode(" "));matFrame.appendChild(labelElt);matFrame.appendChild(document.createElement("br"));group[group.length]=radioElt}
this.m_matGroups[mat.getId()]=group}}}},_onClickedButton:function(btn){if(btn.getId()==IDM.Dialog.Button.OK.getId()){if(this.m_paperChoice!=null){var paper=this.m_paperById[this.m_paperChoice.getSelectedItem().getValue()];this._setPaper(paper)}
if(this.m_localeChoice!=null){var locale=this.m_localeChoice.getSelectedItem().getValue();this._setLocale(locale)}
for(var i=0,n=this.m_materials.getCount();i<n;++i){var material=this.m_materials.getAt(i);var group=this.m_matGroups[material.getId()];var value=null;if(group){if(JSUtils.isArray(group)){for(var j=0,p=group.length;j<p;++j){if(group[j].checked)
value=group[j].m_value}}else
{if(group.checked)
value=material.getValues().getAt(0)}}
this._setMaterialValue(material,value)}}
return true},_getPapers:function(){return new ArrayList()},_getCurrentPaper:function(){return null},_setPaper:function(paper){},_getLocales:function(){return[]},_getCurrentLocale:function(){return null},_setLocale:function(locale){},_getMaterials:function(){return new ArrayList()},_getCurrentMaterialValue:function(material){return null},_getDefaultMaterialValue:function(material){return null},_setMaterialValue:function(material,value){}}});IDM.Product.ImageReframeDialog=Class.define
({ctor:function(){IDM.Product.ImageReframeDialog.baseConstructor.call(this);this.setTitle("Recadrage");this.setButtons([IDM.Dialog.Button.OK,IDM.Dialog.Button.CANCEL]);this.m_xFactor=0.5;this.m_yFactor=0.5;this.m_sFactor=1.0;this.m_imageElt=null;this.m_maskElt=null},inherits:IDM.Dialog,prototype:{_getImageSize:function(id,size,angle){var src="/photo.php?id="+id+"&size="+size+"&angle="+angle;var http=new HTTPRequest(src+"&cmd=getsize");var resp=http.sendSync();var tmp=StringUtils.explode(";",resp);if(tmp.length!=2)
return new Size(1,1);return new Size(parseInt(tmp[0]),parseInt(tmp[1]))},_constructInner:function(contElt,boxElt){var factor=this._getReframeFactor();this.m_xFactor=factor[0];this.m_yFactor=factor[1];this.m_sFactor=factor[2];var imageSize=this._getImageSize(this._getImageId(),1,this._getImageAngle());var largeImageSize=this._getImageSize(this._getImageId(),2,this._getImageAngle());var itemSize=this._getItemSize();imageSize.width=Math.round(imageSize.width);imageSize.height=Math.round(imageSize.height);var itemRatio=((itemSize.height*1.0)/(itemSize.width*1.0));var imageRatio=((imageSize.height*1.0)/(imageSize.width*1.0));var cw=0,ch=0;if(imageRatio<=itemRatio){ch=imageSize.height;cw=Math.floor(ch/itemRatio)}else
{cw=imageSize.width;ch=Math.floor(cw*itemRatio)}
var introElt=document.createElement("div");introElt.innerHTML="Cliquez sur l'image et maintenez le bouton de la souris appuyé,"
+" puis déplacez<br/>le pointeur pour recadrer l'image."
+" Cliquez ensuite sur <strong>OK</strong> pour valider.";var canvasSize=new Size(cw,ch);var canvasElt=document.createElement("div");canvasElt.style.border="1px solid #d0d0d0";canvasElt.style.position="relative";canvasElt.style.width=cw+"px";canvasElt.style.height=ch+"px";canvasElt.style.overflow="hidden";var imgElt=document.createElement("img");imgElt.src="/photo.php?id="+this._getImageId()+"&size=1&rand="+NumberUtils.randomBigNumber()+"&angle="+this._getImageAngle();imgElt.style.cursor="move";imgElt.style.position="absolute";imgElt.style.left=Math.round((canvasSize.width/2)-this.m_xFactor*imageSize.width*this.m_sFactor)+"px";imgElt.style.top=Math.round((canvasSize.height/2)-this.m_yFactor*imageSize.height*this.m_sFactor)+"px";imgElt.style.width=Math.round(imageSize.width*this.m_sFactor)+"px";imgElt.style.height=Math.round(imageSize.height*this.m_sFactor)+"px";imgElt.style.visibility="visible";imgElt.onmousedown=JSUtils.makeCallbackEvent(this,IDM.Product.ImageReframeDialog.prototype._onMouseDownImage);canvasElt.appendChild(imgElt);if(this._getMaskId()!=0){var maskElt=document.createElement("img");maskElt.src="/photo.php?id="+this._getMaskId()+"&size=1&mask=1";maskElt.style.cursor="move";maskElt.style.position="absolute";maskElt.style.left="0px";maskElt.style.top="0px";maskElt.style.width=canvasSize.width+"px";maskElt.style.height=canvasSize.height+"px";maskElt.style.visibility="visible";maskElt.onmousedown=imgElt.onmousedown;canvasElt.appendChild(maskElt);this.m_maskElt=NodeRef.create(maskElt);HTMLUtils.fixPNGImage(maskElt)}
var maskElt=this._createMaskElement(canvasElt,canvasSize,imageSize);if(maskElt!=null){maskElt.onmousedown=imgElt.onmousedown;maskElt.style.cursor="move";canvasElt.appendChild(maskElt)}
var zoomElt=document.createElement("p");zoomElt.style.textAlign="center";var btnPlus=document.createElement("button");btnPlus.className="button-control";btnPlus.appendChild(document.createTextNode("Zoom +"));btnPlus.onclick=JSUtils.makeCallback(this,IDM.Product.ImageReframeDialog.prototype._onClickedZoomPlus);var btnMinus=document.createElement("button");btnMinus.className="button-control";btnMinus.appendChild(document.createTextNode("Zoom -"));btnMinus.onclick=JSUtils.makeCallback(this,IDM.Product.ImageReframeDialog.prototype._onClickedZoomMinus);zoomElt.appendChild(btnMinus);zoomElt.appendChild(document.createTextNode(" "));zoomElt.appendChild(btnPlus);boxElt.appendChild(introElt);boxElt.appendChild(zoomElt);boxElt.appendChild(canvasElt);this.m_imageElt=NodeRef.create(imgElt);this.m_canvasElt=NodeRef.create(canvasElt);this.m_canvasSize=canvasSize;this.m_imageSize=new Size(Math.round(imageSize.width*this.m_sFactor),Math.round(imageSize.height*this.m_sFactor));this.m_origImageSize=imageSize.clone();this.m_largeImageSize=largeImageSize;this.m_imageRatio=imageRatio;this.m_itemSizeMm=this._getItemSizeMm();this.m_dpiBubble=null;this._updateDPI()},_onClickedButton:function(btn){if(this.m_dpiBubble!=null)
this.m_dpiBubble.close();if(btn==IDM.Dialog.Button.OK)
this._setReframeFactor(this.m_xFactor,this.m_yFactor,this.m_sFactor);return true},_onClickedZoomPlus:function(){this._zoomImage(1.1)},_onClickedZoomMinus:function(){this._zoomImage(1.0/1.1)},_zoomImage:function(f){var sf=Math.max(1.0,Math.min(4.0,this.m_sFactor*f));var iw=Math.round(this.m_origImageSize.width*sf);var ih=Math.round(this.m_origImageSize.height*sf);if(iw<this.m_canvasSize.width){iw=this.m_canvasSize.width;ih=Math.floor(iw*this.m_imageRatio)}
if(ih<this.m_canvasSize.height){ih=this.m_canvasSize.height;iw=Math.floor(ih/this.m_imageRatio)}
var dx=iw-this.m_imageSize.width;var dy=ih-this.m_imageSize.height;var imgElt=this.m_imageElt.getElement();var imgPos=HTMLUtils.getElementInnerPos(imgElt);var x=Math.floor(Math.min(0,Math.max(-(iw-this.m_canvasSize.width),imgPos.x-dx/2)));var y=Math.floor(Math.min(0,Math.max(-(ih-this.m_canvasSize.height),imgPos.y-dy/2)));imgElt.style.left=x+"px";imgElt.style.top=y+"px";imgElt.style.width=iw+"px";imgElt.style.height=ih+"px";this.m_imageSize=new Size(iw,ih);this.m_sFactor=((iw*1.0)/(this.m_origImageSize.width*1.0));this._updateFactor();this._updateDPI()},_onMouseDownImage:function(e){var ev=DOMEventUtils.getEvent(e);document.onmousemove=JSUtils.makeCallbackEvent(this,IDM.Product.ImageReframeDialog.prototype._onMouseMoveImage);document.onmouseup=JSUtils.makeCallbackEvent(this,IDM.Product.ImageReframeDialog.prototype._onMouseUpImage);this.m_basePos=HTMLUtils.getElementInnerPos(this.m_imageElt.getElement());this.m_startX=this.m_curX=ev.clientX;this.m_startY=this.m_curY=ev.clientY;return false},_onMouseMoveImage:function(e){var ev=DOMEventUtils.getEvent(e);this.m_curX=ev.clientX;this.m_curY=ev.clientY;var left=(this.m_basePos.x+this.m_curX-this.m_startX);var top=(this.m_basePos.y+this.m_curY-this.m_startY);left=Math.min(0,Math.max(-(this.m_imageSize.width-this.m_canvasSize.width),left));top=Math.min(0,Math.max(-(this.m_imageSize.height-this.m_canvasSize.height),top));var imgElt=this.m_imageElt.getElement();imgElt.style.left=left+"px";imgElt.style.top=top+"px";return false},_onMouseUpImage:function(){this._updateFactor();document.onmousemove=null;document.onmouseup=null;return false},_updateFactor:function(){var imgElt=this.m_imageElt.getElement();var pos=HTMLUtils.getElementInnerPos(imgElt);this.m_xFactor=(this.m_canvasSize.width*0.5-pos.x)/this.m_imageSize.width;this.m_yFactor=(this.m_canvasSize.height*0.5-pos.y)/this.m_imageSize.height},_updateDPI:function(){if(!this.m_itemSizeMm)
return;var MM_PER_INCH=25.4;var largeDPI=Math.min
((this.m_largeImageSize.width*MM_PER_INCH)/this.m_itemSizeMm.width,(this.m_largeImageSize.height*MM_PER_INCH)/this.m_itemSizeMm.height);var curDPI=Math.min
(((this.m_largeImageSize.width*MM_PER_INCH)/this.m_sFactor)/this.m_itemSizeMm.width,((this.m_largeImageSize.height*MM_PER_INCH)/this.m_sFactor)/this.m_itemSizeMm.height);if(curDPI<this._getMinDPI()){if(this.m_dpiBubble==null)
this.m_dpiBubble=IDM.HelpBubble.create();if(!this.m_dpiBubble.isVisible()){var canvasElt=this.m_canvasElt;var dpiBubble=this.m_dpiBubble;HTMLUtils.addOnElementPositionedFunction
(canvasElt.getElement(),function(){dpiBubble.show(canvasElt.getElement(),null,"<img src=\"/styles/image.php?path=products/common/reframe-bad-quality.png\""
+" style=\"float: left; padding-right: 10px; width: 32px; height: 32px\"/>"
+" <span style=\"color: #d00000; font-weight: bold\">Attention ! La résolution de votre image"
+" est insuffisante pour<br/>assurer une qualité d'impression acceptable.</span>",null,20)})}}else
{if(this.m_dpiBubble!=null)
this.m_dpiBubble.close()}},_getImageId:function(){return 0},_getImageAngle:function(){return 0},_getMaskId:function(){return 0},_createMaskElement:function(canvasElt,canvasSize,imageSize){return null},_getReframeFactor:function(){return[0.5,0.5,1.0]},_getItemSize:function(){return new Size(10,10)},_setReframeFactor:function(rfx,rfy,rfs){},_getMinDPI:function(){return 200},_getItemSizeMm:function(){return null}}});IDM.Product.Model=Class.define
({ctor:function(){this.m_id=null;this.m_name="";this.m_productId=0;this.m_previews=[];this.m_layerPreviews=[];this.m_previewLayers=[];this.m_tags=new ArrayList();this.m_infoText="";this.m_prices=new ArrayList();this.m_rectoVerso=false;this.m_customData=[];this.m_width=0;this.m_height=0;this.m_desc="";this.m_finishings=[];this.m_paper="";this.m_minPages=1;this.m_maxPages=1;this.m_options=new ArrayList();this.m_extraPages=null;this.m_variants=new ArrayList()},static:{createFromXML:function(node){var model=new IDM.Product.Model();if(!model._readFromXML(node))
return null;return model}},prototype:{_readFromXML:function(node){this.m_id=parseInt(node.getAttribute("id"));this.m_name=node.getAttribute("name");var types=new Array("small","normal","large");var layers=[];var productNode=XMLUtils.getChildByTagName(node,"product");this.m_productId=parseInt(productNode.getAttribute("id"));var previewNodes=XMLUtils.getChildrenByTagName(node,"preview");for(var i=0,n=previewNodes.length;i<n;++i){var previewNode=previewNodes[i];var layerName=previewNode.getAttribute("layer");if(layerName){if(!JSUtils.arrayContains(layers,layerName))
layers=JSUtils.arrayAdd(layers,layerName)}}
var tagsNode=XMLUtils.getChildByTagName(node,"tags");if(tagsNode!=null){var tagNodes=XMLUtils.getChildrenByTagName(tagsNode,"tag");for(var j=0,p=tagNodes.length;j<p;++j)
this.m_tags.add(IDM.Product.Model.Tag.createFromXML(tagNodes[j]))}
for(var i=0,n=types.length;i<n;++i){var previewType=types[i];var previewNode=XMLUtils.selectSingle(node,"preview[@type='"+previewType+"' and @default='true']");if(previewNode!=null)
this.m_previews[previewType]=IDM.Product.Model.Preview.createFromXML(previewNode);for(var j=0,p=layers.length;j<p;++j){var layer=layers[j];var previewNode=XMLUtils.selectSingle(node,"preview[@type='"+previewType+"' and @layer='"+layer+"']");if(previewNode!=null){if(!this.m_layerPreviews[layer])
this.m_layerPreviews[layer]=[];this.m_layerPreviews[layer][previewType]=IDM.Product.Model.Preview.createFromXML(previewNode)}}}
this.m_previewLayers=layers;this.m_desc=XMLUtils.getChildTextSafe(node,"info-text");var sizeNode=XMLUtils.getChildByTagName(node,"size");var width=parseInt(sizeNode.getAttribute("width"));var height=parseInt(sizeNode.getAttribute("height"));this.m_width=width;this.m_height=height;var paper=XMLUtils.getChildText(node,"paper");this.m_paper=paper;var priceNodes=XMLUtils.getChildrenByTagName(node,"price");var priceNode=priceNodes[0];var priceValue=priceNode.getAttribute("value");var priceNormalValue=priceNode.getAttribute("normal-value");var priceQty=priceNode.getAttribute("quantity");var layersNode=XMLUtils.getChildByTagName(node,"layers");var layersMode=(layersNode==null?null:layersNode.getAttribute("mode"));var finishingNode=XMLUtils.getChildByTagName(node,"finishing");var finishingItemNodes=(finishingNode==null?[]:XMLUtils.getChildrenByTagName(finishingNode,"item"));var finishing="";if(finishingItemNodes.length!=0){for(var i=0,n=finishingItemNodes.length;i<n;++i){var fnode=finishingItemNodes[i];var name=(fnode.getAttribute("name")?fnode.getAttribute("name"):null);var value=XMLUtils.getElementText(fnode);finishing+=(name?(StringUtils.escapeXML(name)+" : "):"")+
StringUtils.escapeXML(value)+"<br/>";this.m_finishings[this.m_finishings.length]={name:name,value:value}}}
var pageStr="";var pageNode=XMLUtils.getChildByTagName(node,"pages");if(pageNode!=null){this.m_minPages=parseInt(pageNode.getAttribute("min"));this.m_maxPages=parseInt(pageNode.getAttribute("max"));pageStr=", "+this.getNicePages()}
this.m_infoText="<div class=\"infos\">"+this.getNiceSize()+StringUtils.escapeXML(pageStr)+"<br/>"
+paper+"<br/>"
+(layersMode==null?"":((layersMode=="recto+verso"?"Recto-verso":"Recto seul")+"<br/>"))
+finishing
+"</div>"
+"<div class=\"price\">"+StringUtils.escapeXML(priceValue)
+(priceNormalValue==priceValue?"":"&#160;&#160;<span class=\"normal-price\">"
+StringUtils.escapeXML(priceNormalValue)+"</span>")
+" pour "+priceQty+" exemplaire"+(priceQty>1?"s":"")+"</div>";for(var i=0,n=priceNodes.length;i<n;++i)
this.m_prices.add(IDM.Product.Model.Price.createFromXML(priceNodes[i]));this.m_rectoVerso=(layersMode=="recto+verso");var customDataNode=XMLUtils.getChildByTagName(node,"custom-data");if(customDataNode!=null){var nodes=XMLUtils.getChildrenElements(customDataNode);for(var i=0,n=nodes.length;i<n;++i){var cdNode=nodes[i];this.m_customData[cdNode.tagName]=XMLUtils.getElementText(cdNode)}}
var optionsNode=XMLUtils.getChildByTagName(node,"options");if(optionsNode!=null){var optionCatNodes=XMLUtils.getChildrenElements(optionsNode,"category");for(var i=0,n=optionCatNodes.length;i<n;++i){var cat=IDM.Product.Model.OptionCategory.createFromXML(optionCatNodes[i]);if(!cat.getOptions().isEmpty())
this.m_options.add(cat)}}
var extraPageNode=XMLUtils.getChildByTagName(node,"extra-page");if(extraPageNode!=null)
this.m_extraPages=IDM.Product.Model.ExtraPageInfos.createFromXML(extraPageNode);var variantsNode=XMLUtils.getChildByTagName(node,"variants");if(variantsNode!=null){var variantNodes=XMLUtils.getChildrenElements(variantsNode,"variant");for(var i=0,n=variantNodes.length;i<n;++i){var v=IDM.Product.Model.Variant.createFromXML(variantNodes[i]);if(v!=null)
this.m_variants.add(v)}}
return true},getId:function(){return this.m_id},getName:function(){return this.m_name},isRectoVerso:function(){return this.m_rectoVerso},getWidth:function(){return this.m_width},getHeight:function(){return this.m_height},getNiceSize:function(){var w=this.getWidth();var h=this.getHeight();if(w>=100||h>=100){return NumberUtils.formatNumber(w*0.1,1,null,null,true,true)
+" x "+NumberUtils.formatNumber(h*0.1,1,null,null,true,true)+" cm"}else
{return w+" x "+h+" mm"}},getMinPages:function(){return this.m_minPages},getMaxPages:function(){return this.m_maxPages},getNicePages:function(){var min=this.getMinPages();var max=this.getMaxPages();var str="";if(min==max){if(min==1)
str="1 page";else
str=min+" pages"}else
{str=" de "+min+" à "+max+" pages"}
return str},getExtraPageInfos:function(){return this.m_extraPages},getFinishings:function(){return this.m_finishings},getOptions:function(){return this.m_options},getDescription:function(){return this.m_desc},getPaper:function(){return this.m_paper},getPreviewLayers:function(){return this.m_previewLayers},getPreview:function(type){var preview=this.m_previews[type];return(preview?preview:null)},getLayerPreview:function(layer,type){var layerPreviews=this.m_layerPreviews[layer];if(!layerPreviews)
return null;var preview=layerPreviews[type];return(preview?preview:null)},getTags:function(){return this.m_tags},hasTag:function(tag){for(var i=0,n=this.m_tags.getCount();i<n;++i){if(this.m_tags.getAt(i).equals(tag))
return true}
return false},getInfoText:function(){return this.m_infoText},getCustomData:function(name){var value=this.m_customData[name];return(value===window.undefined?null:value)},getVariants:function(){return this.m_variants},getPrices:function(){return this.m_prices},estimatePrice:function(qty,shop){var websUrl=URL.parse("/shop/modules/grProduct/_services/estimate-price.php").addParam("product",this.m_productId).addParam("model",this.getId()).addParam("quantity",qty).addParam("shop",JSUtils.isObject(shop)?shop.getId():shop);var webs=new IDM.WebService(websUrl);var res=webs.call();if(webs.isSuccess()){var dom=webs.getResult();var pricesNode=XMLUtils.getRootElement(dom);var priceNodes=XMLUtils.getChildrenByTagName(pricesNode,"price");return IDM.Product.Model.EstimatedPrice.createFromXML(priceNodes[0])}else
{return 9999.9}}}});IDM.Product.Model.Variant=Class.define
({ctor:function(){this.m_id=null;this.m_previews=[];this.m_layerPreviews=[];this.m_previewLayers=[]},static:{createFromXML:function(node){var v=new IDM.Product.Model.Variant();if(!v.readFromXML(node))
return null;return v}},prototype:{getId:function(){return this.m_id},getPreviewLayers:function(){return this.m_previewLayers},getPreview:function(type){var preview=this.m_previews[type];return(preview?preview:null)},getLayerPreview:function(layer,type){var layerPreviews=this.m_layerPreviews[layer];if(!layerPreviews)
return null;var preview=layerPreviews[type];return(preview?preview:null)},readFromXML:function(node){this.m_id=parseInt(node.getAttribute("refid"));var previewsNode=XMLUtils.getChildByTagName(node,"previews");var previewNodes=XMLUtils.getChildrenByTagName(previewsNode,"preview");var types=new Array("small","normal","large");var layers=[];for(var i=0,n=previewNodes.length;i<n;++i){var previewNode=previewNodes[i];var layerName=previewNode.getAttribute("layer");if(layerName){if(!JSUtils.arrayContains(layers,layerName))
layers=JSUtils.arrayAdd(layers,layerName)}}
this.m_previewLayers=layers;for(var i=0,n=types.length;i<n;++i){var previewType=types[i];var previewNode=XMLUtils.selectSingle(previewsNode,"preview[@type='"+previewType+"' and @default='true']");if(previewNode!=null)
this.m_previews[previewType]=IDM.Product.Model.Preview.createFromXML(previewNode);for(var j=0,p=layers.length;j<p;++j){var layer=layers[j];var previewNode=XMLUtils.selectSingle(previewsNode,"preview[@type='"+previewType+"' and @layer='"+layer+"']");if(previewNode!=null){if(!this.m_layerPreviews[layer])
this.m_layerPreviews[layer]=[];this.m_layerPreviews[layer][previewType]=IDM.Product.Model.Preview.createFromXML(previewNode)}}}
return true}}});IDM.Product.Model.ExtraPageInfos=Class.define
({ctor:function(){this.m_allIn=false;this.m_count=0;this.m_price=0.0;this.m_unitPrice=0.0},static:{createFromXML:function(node){var epInfos=new IDM.Product.Model.ExtraPageInfos();epInfos.m_allIn=(node.getAttribute("all-in")=="true");epInfos.m_count=node.getAttribute("count");epInfos.m_price=node.getAttribute("price");epInfos.m_unitPrice=node.getAttribute("unit-price");return epInfos}},prototype:{isAllIn:function(){return this.m_allIn},getCount:function(){return this.m_count},getPrice:function(){return this.m_price},getUnitPrice:function(){return this.m_unitPrice}}});IDM.Product.Model.EstimatedPrice=Class.define
({ctor:function(){},static:{createFromXML:function(node){var eprice=new IDM.Product.Model.EstimatedPrice();eprice.m_qty=parseInt(node.getAttribute("quantity"));eprice.m_price=node.getAttribute("price");eprice.m_unitPrice=node.getAttribute("unit-price");eprice.m_priceWithShipping=node.getAttribute("price-with-shipping");var shipNode=XMLUtils.getChildByTagName(node,"shipping");if(shipNode!=null){eprice.m_shipCost=shipNode.getAttribute("cost");eprice.m_shipMode=shipNode.getAttribute("mode");eprice.m_shipCountry=shipNode.getAttribute("country")}else
{eprice.m_shipCost=0;eprice.m_shipMode=0;eprice.m_shipCountry="(unknown)"}
return eprice}},prototype:{getQuantity:function(){return this.m_qty},getPrice:function(){return this.m_price},getUnitPrice:function(){return this.m_unitPrice},getPriceWithShipping:function(){return this.m_priceWithShipping},getShippingCost:function(){return this.m_shipCost},getShippingMode:function(){return this.m_shipMode},getShippingCountry:function(){return this.m_shipCountry}}});IDM.Product.Model.OptionCategory=Class.define
({ctor:function(name){this.m_name=name;this.m_options=new ArrayList()},static:{createFromXML:function(node){var ocat=new IDM.Product.Model.OptionCategory(node.getAttribute("name"));var optionNodes=XMLUtils.getChildrenByTagName(node,"option");for(var i=0,n=optionNodes.length;i<n;++i)
ocat.addOption(IDM.Product.Model.Option.createFromXML(optionNodes[i]));return ocat}},prototype:{getName:function(){return this.m_name},getOptions:function(){return this.m_options},addOption:function(opt){this.m_options.add(opt)}}});IDM.Product.Model.Option=Class.define
({ctor:function(name,totalPrice,perPagePrice){this.m_name=name;this.m_totalPrice=totalPrice;this.m_perPagePrice=perPagePrice},static:{createFromXML:function(node){var name=XMLUtils.getChildText(node,"name");var costNode=XMLUtils.getChildByTagName(node,"cost");var totalPrice=costNode.getAttribute("total");var perPagePrice=costNode.getAttribute("per-page");var opt=new IDM.Product.Model.Option(name,totalPrice,perPagePrice);return opt}},prototype:{getName:function(){return this.m_name},getTotalPrice:function(){return this.m_totalPrice},getPerPagePrice:function(){return this.m_perPagePrice}}});IDM.Product.Model.Price=Class.define
({ctor:function(qty,price,normalPrice,unitPrice,rebate,totalRebate){this.m_quantity=qty;this.m_price=price;this.m_normalPrice=normalPrice;this.m_unitPrice=unitPrice;this.m_rebate=(JSUtils.toString(rebate).length==0?null:rebate);this.m_totalRebate=(JSUtils.toString(totalRebate).length==0?null:totalRebate)},static:{createFromXML:function(node){return new IDM.Product.Model.Price(parseInt(node.getAttribute("quantity")),node.getAttribute("value"),node.getAttribute("normal-value"),node.getAttribute("unit"),node.getAttribute("rebate"),node.getAttribute("total-rebate"))}},prototype:{getQuantity:function(){return this.m_quantity},getPrice:function(){return this.m_price},getNormalPrice:function(){return this.m_normalPrice},getUnitPrice:function(){return this.m_unitPrice},getRebate:function(){return this.m_rebate},getTotalRebate:function(){return this.m_totalRebate}}});IDM.Product.Model.Preview=Class.define
({ctor:function(src,width,height,border){this.m_src=src;this.m_width=width;this.m_height=height;this.m_border=border},static:{TYPE_SMALL:"small",TYPE_MEDIUM:"normal",TYPE_LARGE:"large",createFromXML:function(node){return new IDM.Product.Model.Preview(node.getAttribute("url"),parseInt(node.getAttribute("width")),parseInt(node.getAttribute("height")),node.getAttribute("border")==="true")}},prototype:{getSource:function(){return this.m_src},getWidth:function(){return this.m_width},getHeight:function(){return this.m_height},getSize:function(){return new Size(this.getWidth(),this.getHeight())},hasBorder:function(){return this.m_border}}});IDM.Product.Model.Tag=Class.define
({ctor:function(id,name){this.m_id=id;this.m_name=name;this.m_selected=false;this.m_category=null},static:{createFromXML:function(node){if(node.getAttribute("refid"))
return IDM.Product.Model.Tag.createRef(node.getAttribute("refid"));else
return new IDM.Product.Model.Tag(parseInt(node.getAttribute("id")),node.getAttribute("name"))},createRef:function(id){return new IDM.Product.Model.Tag(id,"")}},prototype:{getId:function(){return this.m_id},getName:function(){return this.m_name},equals:function(other){return this.m_id==other.getId()},isSelected:function(){return this.m_selected},setSelected:function(sel){this.m_selected=(sel?true:false)},getCategory:function(){return this.m_category},setCategory:function(cat){this.m_category=cat}}});IDM.Product.Model.TagCategory=Class.define
({ctor:function(id,name,flags){this.m_id=id;this.m_name=name;this.m_flags=flags;this.m_tags=new ArrayList()},static:{FLAG_MUTUALLY_EXCLUSIVE:0x1,s_allCats:null,getAll:function(){if(IDM.Product.Model.TagCategory.s_allCats!=null)
return IDM.Product.Model.TagCategory.s_allCats;var url=new URL("/modules/grModel/tagging/_services/enum-tags-and-categories.php");var webs=new IDM.WebService(url);webs.call();if(!webs.isSuccess()){if(JSUtils.isDebug())
alert(webs.getError());IDM.Product.Model.TagCategory.s_allTags=new ArrayList();return new ArrayList()}
var doc=webs.getResult();var root=XMLUtils.getRootElement(doc);var catsNode=XMLUtils.getChildByTagName(root,"tag-categories");var catNodes=XMLUtils.getChildrenByTagName(catsNode,"tag-category");var cats=new ArrayList();for(var i=0,n=catNodes.length;i<n;++i){var catNode=catNodes[i];var cat=IDM.Product.Model.TagCategory.createFromXML(catNode);var tagsNode=XMLUtils.getChildByTagName(root,"tags");var tagNodes=XMLUtils.getChildrenByTagName(tagsNode,"tag");for(var t=0,tn=tagNodes.length;t<tn;++t){var tagNode=tagNodes[t];var catNode=XMLUtils.getChildByTagName(tagNode,"tag-category");if(catNode&&parseInt(catNode.getAttribute("refid"))==cat.getId()){var tag=IDM.Product.Model.Tag.createFromXML(tagNode);cat.addTag(tag)}}
cats.add(cat)}
IDM.Product.Model.TagCategory.s_allCats=cats;return cats},createFromXML:function(node){return new IDM.Product.Model.TagCategory(parseInt(node.getAttribute("id")),node.getAttribute("name"),parseInt(node.getAttribute("flags")))}},prototype:{getId:function(){return this.m_id},getName:function(){return this.m_name},getFlags:function(){return this.m_flags},hasFlag:function(flag){return(this.getFlags()&flag)!=0},getTags:function(){return this.m_tags},addTag:function(tag){tag.setCategory(this);this.m_tags.add(tag)}}});IDM.Product.Model.Loader=Class.define
({ctor:function(shopId,productId){IDM.Product.Model.Loader.baseConstructor.call(this);this.m_shopId=shopId;this.m_productId=productId;this.m_models=new ArrayList()},static:{s_cache:[]},inherits:IDM.AsynchronousLoader,prototype:{load:function(){if(IDM.Product.Model.Loader.s_cache[this.m_shopId+"/"+this.m_productId]){this._processDoc(IDM.Product.Model.Loader.s_cache[this.m_shopId+"/"+this.m_productId]);return}
var url=new URL("/shop/enum-models.php").addParam("shop",this.m_shopId).addParam("product",this.m_productId);var webs=new IDM.WebService(url);webs.callAsync(JSUtils.makeCallback(this,IDM.Product.Model.Loader.prototype._onWebsResponse,webs))},_onWebsResponse:function(webs,response){if(!webs.isSuccess()){if(JSUtils.isDebug())
alert(webs.getError());this.fireLoaded();return}
var doc=webs.getResult();IDM.Product.Model.Loader.s_cache[this.m_shopId+"/"+this.m_productId]=doc;this._processDoc(doc)},_processDoc:function(doc){var root=XMLUtils.getRootElement(doc);var modelNodes=XMLUtils.getChildrenByTagName(root,"model");var models=new ArrayList();for(var i=0,n=modelNodes.length;i<n;++i){var modelNode=modelNodes[i];var model=IDM.Product.Model.createFromXML(modelNode);if(model!=null)
this.m_models.add(model)}
this.fireLoaded()},getCount:function(filter){var models=this._getModels(filter);return models.getCount()},getRange:function(start,count,filter){var models=this._getModels(filter);return models.slice(start,count)},_getModels:function(filter){if(!filter){return this.m_models}else
{var models=new ArrayList();for(var i=0,n=this.m_models.getCount();i<n;++i){var model=this.m_models.getAt(i);if(filter.doesModelMatch(model))
models.add(model)}
return models}}}});IDM.Product.Model.Loader.Filter=Class.define
({ctor:function(){this.m_tags=new ArrayList()},prototype:{addTag:function(tag){this.m_tags.add(tag)},doesModelMatch:function(model){if(this.m_tags.isEmpty())
return true;for(var i=0,n=this.m_tags.getCount();i<n;++i){var tag=this.m_tags.getAt(i);if(!model.hasTag(tag))
return false}
return true}}});IDM.Product.Frame=Class.define
({ctor:function(){this.m_id=0;this.m_name="";this.m_width=0;this.m_color=Color.BLACK;this.m_outerEdgeWidth=0;this.m_outerEdgeColor=Color.BLACK;this.m_innerEdgeWidth=0;this.m_innerEdgeColor=Color.BLACK},static:{createFromXML:function(dom,node){var frame=new IDM.Product.Frame();if(!frame.readFromXML(dom,node))
return null;return frame}},prototype:{getName:function(){return this.m_name},setName:function(name){this.m_name=name},getWidth:function(){return this.m_width},setWidth:function(width){this.m_width=width},getColor:function(){return this.m_color},setColor:function(color){this.m_color=color},hasInnerEdge:function(){return Math.abs(this.m_innerEdgeWidth)>=0.001},getInnerEdgeWidth:function(){return this.m_innerEdgeWidth},setInnerEdgeWidth:function(width){this.m_innerEdgeWidth=width},getInnerEdgeColor:function(){return this.m_innerEdgeColor},setInnerEdgeColor:function(color){this.m_innerEdgeColor=color},hasOuterEdge:function(){return Math.abs(this.m_outerEdgeWidth)>=0.001},getOuterEdgeWidth:function(){return this.m_outerEdgeWidth},setOuterEdgeWidth:function(width){this.m_outerEdgeWidth=width},getOuterEdgeColor:function(){return this.m_outerEdgeColor},setOuterEdgeColor:function(color){this.m_outerEdgeColor=color},clone:function(){var frame=new IDM.Product.Frame();frame.m_name=this.m_name;frame.m_width=this.m_width;frame.m_color=this.m_color.clone(),frame.m_outerEdgeWidth=this.m_outerEdgeWidth;frame.m_outerEdgeColor=this.m_outerEdgeColor.clone();frame.m_innerEdgeWidth=this.m_innerEdgeWidth;frame.m_innerEdgeColor=this.m_innerEdgeColor.clone();return frame},equals:function(other){if(Math.abs(this.m_width+other.m_width)>=0.001){if(Math.abs(this.m_width-other.m_width)>=0.001||!this.m_color.equals(other.m_color))
return false}
if(Math.abs(this.m_outerEdgeWidth+other.m_outerEdgeWidth)>=0.001){if(Math.abs(this.m_outerEdgeWidth-other.m_outerEdgeWidth)>=0.001||!this.m_outerEdgeColor.equals(other.m_outerEdgeColor)){return false}}
if(Math.abs(this.m_innerEdgeWidth+other.m_innerEdgeWidth)>=0.001){if(Math.abs(this.m_innerEdgeWidth-other.m_innerEdgeWidth)>=0.001||!this.m_innerEdgeColor.equals(other.m_innerEdgeColor)){return false}}
return true},writeToXML:function(dom,tagName){if(!tagName)
tagName="frame";var node=dom.createElement(tagName);node.setAttribute("id",this.m_id);XMLUtils.setChildText(dom,node,"name",this.m_name);interiorNode=dom.createElement("interior");node.appendChild(interiorNode);interiorNode.setAttribute("width",Math.round(this.getWidth()*10.0));interiorNode.setAttribute("color",this.getColor().toHex());innerNode=dom.createElement("inner-edge");node.appendChild(innerNode);innerNode.setAttribute("width",Math.round(this.getInnerEdgeWidth()*10.0));innerNode.setAttribute("color",this.getInnerEdgeColor().toHex());outerNode=dom.createElement("outer-edge");node.appendChild(outerNode);outerNode.setAttribute("width",Math.round(this.getOuterEdgeWidth()*10.0));outerNode.setAttribute("color",this.getOuterEdgeColor().toHex());return node},readFromXML:function(dom,node){this.m_id=parseInt(node.getAttribute("id"));this.m_name=XMLUtils.getChildTextSafe(node,"name");var interiorNode=XMLUtils.getChildByTagName(node,"interior");if(interiorNode){this.m_width=parseInt(interiorNode.getAttribute("width"))*0.1;this.m_color=Color.fromHex(interiorNode.getAttribute("color"))}else
{this.m_width=0;this.m_color=Color.BLACK}
var innerNode=XMLUtils.getChildByTagName(node,"inner-edge");if(innerNode){this.m_innerEdgeWidth=parseInt(innerNode.getAttribute("width"))*0.1;this.m_innerEdgeColor=Color.fromHex(innerNode.getAttribute("color"))}else
{this.m_innerEdgeWidth=0;this.m_innerEdgeColor=Color.BLACK}
var outerNode=XMLUtils.getChildByTagName(node,"outer-edge");if(outerNode){this.m_outerEdgeWidth=parseInt(outerNode.getAttribute("width"))*0.1;this.m_outerEdgeColor=Color.fromHex(outerNode.getAttribute("color"))}else
{this.m_outerEdgeWidth=0;this.m_outerEdgeColor=Color.BLACK}
return true}}});IDM.Product.FrameDialog=Class.define
({ctor:function(){IDM.Product.FrameDialog.baseConstructor.call(this);this.setTitle("Encadrement de la photo");this.setButtons([IDM.Dialog.Button.OK,IDM.Dialog.Button.CANCEL]);this.m_frame=new IDM.Product.Frame();this.m_loadedFrame=null;this.m_templateFrame=null;this.m_widthElt=null;this.m_colorElt=null;this.m_outerEdgeWidthElt=null;this.m_outerEdgeColorElt=null;this.m_innerEdgeWidthElt=null;this.m_innerEdgeColorElt=null;this.m_previewElt=null;this.m_previewTemplateElt=null;this.m_previewOuterElt=null;this.m_previewInteriorElt=null;this.m_previewInnerElt=null;this.m_applyValue="item";this.m_options={};this.m_imageId=0;this.m_savedFramesElt=null},inherits:IDM.Dialog,static:{s_frames:null},prototype:{getFrame:function(){return this.m_frame},setFrame:function(frame){this.m_frame=frame},getApplyValue:function(){return this.m_applyValue},setImageId:function(imageId){this.m_imageId=imageId},_constructInner:function(contElt,boxElt){var frame=this.m_frame;var leftElt=document.createElement("div");var rightElt=document.createElement("div");var tableElt=HTMLUtils.createTable([[leftElt,rightElt]]);boxElt.appendChild(tableElt);var interiorFrameElt=HTMLUtils.createFieldSet("Cadre");leftElt.appendChild(interiorFrameElt);var p=document.createElement("p");interiorFrameElt.appendChild(p);var widthElt=new IDM.ThicknessChooser();widthElt.setThickness(frame.getWidth());widthElt.setColor(frame.getColor());widthElt.setAllowedThicknesses([]);widthElt.getNamedSlot("thickness-changed").attach
(JSUtils.makeCallback(this,IDM.Product.FrameDialog.prototype._updateFromUserData));p.appendChild(HTMLUtils.createLabel(widthElt.getHTMLElement(),"Épaisseur : "));p.appendChild(widthElt.getHTMLElement());this.m_widthElt=widthElt;p=document.createElement("p");interiorFrameElt.appendChild(p);var colorElt=new IDM.ColorChooser();colorElt.setColor(frame.getColor());colorElt.getNamedSlot("color-changed").attach
(JSUtils.makeCallback(this,IDM.Product.FrameDialog.prototype._updateFromUserData));p.appendChild(HTMLUtils.createLabel(colorElt.getHTMLElement(),"Couleur : "));p.appendChild(colorElt.getHTMLElement());this.m_colorElt=colorElt;var outerEdgeFrameElt=HTMLUtils.createFieldSet("Liseré extérieur");leftElt.appendChild(outerEdgeFrameElt);p=document.createElement("p");outerEdgeFrameElt.appendChild(p);widthElt=new IDM.ThicknessChooser();widthElt.setThickness(frame.getOuterEdgeWidth());widthElt.setColor(frame.getOuterEdgeColor());widthElt.setAllowedThicknesses([]);widthElt.getNamedSlot("thickness-changed").attach
(JSUtils.makeCallback(this,IDM.Product.FrameDialog.prototype._updateFromUserData));p.appendChild(HTMLUtils.createLabel(widthElt.getHTMLElement(),"Épaisseur : "));p.appendChild(widthElt.getHTMLElement());this.m_outerEdgeWidthElt=widthElt;p=document.createElement("p");outerEdgeFrameElt.appendChild(p);colorElt=new IDM.ColorChooser();colorElt.setColor(frame.getOuterEdgeColor());colorElt.getNamedSlot("color-changed").attach
(JSUtils.makeCallback(this,IDM.Product.FrameDialog.prototype._updateFromUserData));p.appendChild(HTMLUtils.createLabel(colorElt.getHTMLElement(),"Couleur : "));p.appendChild(colorElt.getHTMLElement());this.m_outerEdgeColorElt=colorElt;var innerEdgeFrameElt=HTMLUtils.createFieldSet("Liseré intérieur");leftElt.appendChild(innerEdgeFrameElt);p=document.createElement("p");innerEdgeFrameElt.appendChild(p);widthElt=new IDM.ThicknessChooser();widthElt.setThickness(frame.getInnerEdgeWidth());widthElt.setColor(frame.getInnerEdgeColor());widthElt.setAllowedThicknesses([]);widthElt.getNamedSlot("thickness-changed").attach
(JSUtils.makeCallback(this,IDM.Product.FrameDialog.prototype._updateFromUserData));p.appendChild(HTMLUtils.createLabel(widthElt.getHTMLElement(),"Épaisseur : "));p.appendChild(widthElt.getHTMLElement());this.m_innerEdgeWidthElt=widthElt;p=document.createElement("p");innerEdgeFrameElt.appendChild(p);colorElt=new IDM.ColorChooser();colorElt.setColor(frame.getInnerEdgeColor());colorElt.getNamedSlot("color-changed").attach
(JSUtils.makeCallback(this,IDM.Product.FrameDialog.prototype._updateFromUserData));p.appendChild(HTMLUtils.createLabel(colorElt.getHTMLElement(),"Couleur : "));p.appendChild(colorElt.getHTMLElement());this.m_innerEdgeColorElt=colorElt;var previewFrameElt=HTMLUtils.createFieldSet("Prévisualisation");rightElt.appendChild(previewFrameElt);var previewElt=document.createElement("div");previewFrameElt.appendChild(previewElt);previewElt.style.overflow="hidden";previewElt.style.position="relative";previewElt.style.backgroundImage="url(/styles/default/images/fw/transparent2.png)";previewElt.className="preview-control";HTMLUtils.setElementSize(previewElt,new Size(250,150));var previewTemplateElt=document.createElement("div");previewElt.appendChild(previewTemplateElt);previewTemplateElt.style.position="absolute";previewTemplateElt.style.left=previewTemplateElt.style.top="2px";previewTemplateElt.style.color="#000000";previewTemplateElt.style.fontWeight="bold";var previewOuterElt=document.createElement("div");previewOuterElt.style.marginLeft="20px";previewOuterElt.style.marginTop="20px";previewElt.appendChild(previewOuterElt);var previewInteriorElt=document.createElement("div");previewOuterElt.appendChild(previewInteriorElt);var previewInnerElt=document.createElement("div");previewInteriorElt.appendChild(previewInnerElt);previewInteriorElt.style.backgroundColor="#000000";HTMLUtils.setElementSize(previewOuterElt,new Size(300,300));HTMLUtils.setElementSize(previewInteriorElt,new Size(300,300));HTMLUtils.setElementSize(previewInnerElt,new Size(300,300));this.m_previewElt=NodeRef.create(previewElt);this.m_previewTemplateElt=NodeRef.create(previewTemplateElt);this.m_previewOuterElt=NodeRef.create(previewOuterElt);this.m_previewInteriorElt=NodeRef.create(previewInteriorElt);this.m_previewInnerElt=NodeRef.create(previewInnerElt);var imgElt=document.createElement("img");imgElt.src="/photo.php?id="+this.m_imageId+"&size=1&rand="+NumberUtils.randomBigNumber();imgElt.style.border="0px solid black";previewInnerElt.appendChild(imgElt);if(IDM.Product.FrameDialog.s_frames==null){var webs=new IDM.WebService(URL.parse("/shop/services/session/data/get-frames.php"));webs.call();if(webs.isSuccess()){var dom=webs.getResult();var rootNode=XMLUtils.getRootElement(dom);var frameNodes=XMLUtils.getChildrenElements(rootNode);IDM.Product.FrameDialog.s_frames=new ArrayList();for(var i=0,n=frameNodes.length;i<n;++i){var frameNode=frameNodes[i];var frame=IDM.Product.Frame.createFromXML(dom,frameNode);if(frame!=null)
IDM.Product.FrameDialog.s_frames.add(frame)}}else
{IDM.Product.FrameDialog.s_frames=new ArrayList()}}
var savedFramesFrameElt=HTMLUtils.createFieldSet("Vos modèles de cadres");rightElt.appendChild(savedFramesFrameElt);var selectElt=new IDM.Chooser();var labelElt=HTMLUtils.createLabel(selectElt,"Modèles enregistrés :");p=document.createElement("p");savedFramesFrameElt.appendChild(p);p.appendChild(labelElt);p.appendChild(document.createElement("br"));p.appendChild(selectElt.getHTMLElement());for(var i=0,n=IDM.Product.FrameDialog.s_frames.getCount();i<n;++i){var frame=IDM.Product.FrameDialog.s_frames.getAt(i);var item=new IDM.Chooser.Item(frame.getName(),frame);selectElt.addItem(item);if(this.m_frame.equals(frame)){this.m_templateFrame=frame;this.m_loadedFrame=frame}}
this.m_savedFramesElt=selectElt;p=document.createElement("p");savedFramesFrameElt.appendChild(p);p.appendChild(HTMLUtils.createButton("Charger",JSUtils.makeCallback(this,IDM.Product.FrameDialog.prototype._onClickedLoadFrame)));p.appendChild(document.createTextNode(" "));p.appendChild(HTMLUtils.createButton("Sauver...",JSUtils.makeCallback(this,IDM.Product.FrameDialog.prototype._onClickedSaveFrame)));p.appendChild(document.createTextNode(" "));p.appendChild(HTMLUtils.createButton("Supprimer",JSUtils.makeCallback(this,IDM.Product.FrameDialog.prototype._onClickedDeleteFrame)));var selectEltApply=new IDM.Chooser();var labelElt=HTMLUtils.createLabel(selectEltApply,"Appliquer à : ");boxElt.appendChild(labelElt);boxElt.appendChild(selectEltApply.getHTMLElement());var options=this.getPageOptions()
for(var value in options){var item=new IDM.Chooser.Item(options[value],value);selectEltApply.addItem(item)}
selectEltApply.getNamedSlot("item-selected").attach(JSUtils.makeCallback(this,IDM.Product.FrameDialog.prototype._applyAll));this._updatePreview()},setPageOptions:function(options){this.m_options=options},getPageOptions:function(){return this.m_options},_applyAll:function(slot,item){this.m_applyValue=item.getValue()},_onClickedLoadFrame:function(){var item=this.m_savedFramesElt.getSelectedItem();if(item==null||item.getValue()==null)
return;var frame=item.getValue();this.m_frame=frame.clone();this.m_loadedFrame=frame;this.m_templateFrame=frame;this._updateUserData()},_onClickedSaveFrame:function(){var dlg=new IDM.MessageBox();dlg.setTitle("Sauver le cadre");dlg.setText("Entrez un nom pour sauvegarder un nouveau cadre.\n"
+"Vous pouvez aussi entrer le nom d'un cadre existant pour le remplacer.");dlg.setButtons([IDM.Dialog.Button.OK,IDM.Dialog.Button.CANCEL]);dlg.setPrompt("Nom du cadre :",this.m_loadedFrame?this.m_loadedFrame.getName():"");dlg.setOnClickedButtonCallback(JSUtils.makeCallback(this,IDM.Product.FrameDialog.prototype._onClickedSaveFrame2));dlg.show()},_onClickedSaveFrame2:function(dlg,res){if(res.getButton()==IDM.Dialog.Button.OK){var name=StringUtils.trim(res.getPromptValue());if(name.length==0){var errorDlg=new IDM.MessageBox();errorDlg.setTitle("Erreur");errorDlg.setText("Vous devez entrer un nom pour le cadre.");errorDlg.show();return false}else
{var index=-1;for(var i=0,n=IDM.Product.FrameDialog.s_frames.getCount();i<n;++i){var frm=IDM.Product.FrameDialog.s_frames.getAt(i);if(frm.getName()==name){index=i;break}}
var frm=this.m_frame.clone();frm.setName(name);if(index==-1){var item=new IDM.Chooser.Item(frm.getName(),frm);this.m_savedFramesElt.addItem(item);this.m_savedFramesElt.selectItem(item);IDM.Product.FrameDialog.s_frames.add(frm)}else
{IDM.Product.FrameDialog.s_frames.setAt(index,frm)}}}
return true},_onClickedDeleteFrame:function(){var item=this.m_savedFramesElt.getSelectedItem();if(item==null||item.getValue()==null)
return;var frame=item.getValue();var this_=this;var callback=function(dlg,result){if(result.getButton()==IDM.Dialog.Button.YES){IDM.Product.FrameDialog.s_frames.remove(frame);this_.m_savedFramesElt.removeItem(item);if(this_.m_templateFrame==frame)
this_.m_templateFrame=null;this_.updatePreview()}
return true};var dlg=new IDM.MessageBox();dlg.setTitle("Supprimer le modèle");dlg.setText("Vous confirmez la suppression de ce modèle de cadre ?");dlg.setButtons([IDM.Dialog.Button.YES,IDM.Dialog.Button.NO]);dlg.setOnClickedButtonCallback(callback);dlg.show()},_updateFromUserData:function(){this.m_frame.setWidth(this.m_widthElt.getThickness());this.m_frame.setColor(this.m_colorElt.getColor());this.m_widthElt.setColor(this.m_colorElt.getColor());this.m_outerEdgeWidthElt.setColor(this.m_outerEdgeColorElt.getColor());this.m_innerEdgeWidthElt.setColor(this.m_innerEdgeColorElt.getColor());this.m_frame.setOuterEdgeWidth(this.m_outerEdgeWidthElt.getThickness());this.m_frame.setOuterEdgeColor(this.m_outerEdgeColorElt.getColor());this.m_frame.setInnerEdgeWidth(this.m_innerEdgeWidthElt.getThickness());this.m_frame.setInnerEdgeColor(this.m_innerEdgeColorElt.getColor());this.m_templateFrame=null;this._updatePreview()},_updateUserData:function(){this.m_widthElt.setThickness(this.m_frame.getWidth());this.m_widthElt.setColor(this.m_frame.getColor());this.m_colorElt.setColor(this.m_frame.getColor());this.m_outerEdgeWidthElt.setThickness(this.m_frame.getOuterEdgeWidth());this.m_outerEdgeWidthElt.setColor(this.m_frame.getOuterEdgeColor());this.m_outerEdgeColorElt.setColor(this.m_frame.getOuterEdgeColor());this.m_innerEdgeWidthElt.setThickness(this.m_frame.getInnerEdgeWidth());this.m_innerEdgeWidthElt.setColor(this.m_frame.getInnerEdgeColor());this.m_innerEdgeColorElt.setColor(this.m_frame.getInnerEdgeColor());this._updatePreview()},_updatePreview:function(){var frame=this.m_frame;var intElt=this.m_previewInteriorElt.getElement();intElt.style.borderStyle="solid";intElt.style.borderTopWidth=intElt.style.borderLeftWidth=this._mapThickness(frame.getWidth())+"px";intElt.style.borderBottomWidth=intElt.style.borderRightWidth="0px";intElt.style.borderColor=frame.getColor().toHex();var outerElt=this.m_previewOuterElt.getElement();outerElt.style.borderStyle="solid";outerElt.style.borderTopWidth=outerElt.style.borderLeftWidth=this._mapThickness(frame.getOuterEdgeWidth())+"px";outerElt.style.borderBottomWidth=outerElt.style.borderRightWidth="0px";outerElt.style.borderColor=frame.getOuterEdgeColor().toHex();var innerElt=this.m_previewInnerElt.getElement();innerElt.style.borderStyle="solid";innerElt.style.borderTopWidth=innerElt.style.borderLeftWidth=this._mapThickness(frame.getInnerEdgeWidth())+"px";innerElt.style.borderBottomWidth=innerElt.style.borderRightWidth="0px";innerElt.style.borderColor=frame.getInnerEdgeColor().toHex();var templateName=(this.m_templateFrame==null?"":this.m_templateFrame.getName());var templateElt=this.m_previewTemplateElt.getElement();HTMLUtils.setElementText(templateElt,templateName)},_mapThickness:function(t){if(Math.abs(t)<=0.001)
return 0;return Math.max(1.0,Math.round(t))},_onClickedButton:function(btn){var dom=XMLUtils.createDocument();var rootNode=dom.createElement("frames");dom.appendChild(rootNode);for(var i=0,n=IDM.Product.FrameDialog.s_frames.getCount();i<n;++i){var frame=IDM.Product.FrameDialog.s_frames.getAt(i);rootNode.appendChild(frame.writeToXML(dom))}
var webs=new IDM.WebService(URL.parse("/shop/services/session/data/set-frames.php"));webs.setData(dom);JSUtils.invokeLater(JSUtils.makeCallback(webs,IDM.WebService.prototype.call));return true}}});IDM.Product.ImageFXDialog=Class.define
({ctor:function(){IDM.Product.ImageFXDialog.baseConstructor.call(this);this.declareSlot("effects-changed");this.setTitle("Filtres et effets spéciaux");this.setButtons([IDM.Dialog.Button.OK,IDM.Dialog.Button.CANCEL]);this.m_effects=new IDM.Product.ImageEffectList();this.m_allEffects=new IDM.Product.ImageEffectList();this.m_curEffect=null;this.m_curItemElt=null;this.m_previewElt=null;this.m_previewImgElt=null;this.m_configContElt=null},inherits:IDM.Dialog,prototype:{setEffects:function(effects){this.m_effects=effects.clone()},getEffects:function(){return this.m_effects},_constructInner:function(contElt,boxElt){var listContElt=document.createElement("div");listContElt.style.paddingRight="1em";var listElt=document.createElement("div");listElt.className="list-control";listElt.onmousedown=JSUtils.IGNORE_EVENT_FUNCTION;HTMLUtils.setElementSize(listElt,new Size(150,500));listContElt.appendChild(document.createTextNode("Effets :"));listContElt.appendChild(document.createElement("br"));listContElt.appendChild(listElt);var allEffects=IDM.Product.ImageEffectFactory.enumEffects();for(var i=0,n=allEffects.getCount();i<n;++i){var effect=allEffects.getAt(i);var curEffect=this.m_effects.getEffectById(effect.getId());if(curEffect!=null)
effect=curEffect;var itemElt=document.createElement("div");itemElt.className="item";itemElt.style.textAlign="center";itemElt.style.padding="0.3em";itemElt.m_effect=effect;var imgElt=document.createElement("img");imgElt.src=effect.getImage();var nameElt=document.createElement("div");var checkElt=HTMLUtils.createCheckbox();nameElt.appendChild(checkElt);nameElt.appendChild(document.createTextNode(" "));nameElt.appendChild(document.createTextNode(effect.getName()));checkElt.name="effect"+i;checkElt.defaultChecked=checkElt.checked=(curEffect!=null);itemElt.appendChild(imgElt);itemElt.appendChild(nameElt);listElt.appendChild(itemElt);itemElt.onclick=JSUtils.makeCallbackEvent
(this,IDM.Product.ImageFXDialog.prototype._onClickedItem,NodeRef.create(itemElt));checkElt.onclick=JSUtils.makeCallbackEvent
(this,IDM.Product.ImageFXDialog.prototype._onCheckedItem,NodeRef.create(checkElt),NodeRef.create(itemElt));effect.m_itemElt=NodeRef.create(itemElt);effect.m_checkElt=NodeRef.create(checkElt)}
var previewContElt=document.createElement("div");var previewSize=new Size(500,350);var previewElt=document.createElement("div");previewElt.className="preview-control";previewElt.style.lineHeight=previewSize.height+"px";previewElt.style.verticalAlign="middle";previewElt.style.textAlign="center";var previewImgElt=document.createElement("img");previewImgElt.setAttribute("id","previewImage");previewElt.appendChild(previewImgElt);previewImgElt.style.verticalAlign="middle";HTMLUtils.setElementSize(previewElt,previewSize);previewContElt.appendChild(document.createTextNode("Aperçu :"));previewContElt.appendChild(document.createElement("br"));previewContElt.appendChild(previewElt);this.m_previewElt=NodeRef.create(previewElt);this.m_previewImgElt=NodeRef.create(previewImgElt);var configContElt=document.createElement("div");configContElt.style.overflow="hidden";HTMLUtils.setElementSize(configContElt,new Size(500,150));this.m_configContElt=NodeRef.create(configContElt);var table2Elt=HTMLUtils.createTable([[previewContElt],[configContElt]]);var tableElt=HTMLUtils.createTable([[listContElt,table2Elt]]);boxElt.appendChild(tableElt);this._updatePreview()},_onClickedItem:function(itemElt,ev){DOMEventUtils.stopPropagation(ev);if(this.m_curItemElt!=null){HTMLUtils.removeStyleClass(this.m_curItemElt.getElement(),"selected");this.m_curItemElt=null}
HTMLUtils.addStyleClass(itemElt.getElement(),"selected");var effect=itemElt.getElement().m_effect;this.m_curEffect=effect;this.m_curItemElt=itemElt;var configElt=this.m_configContElt.getElement();HTMLUtils.removeAllChildren(configElt);var frameElt=HTMLUtils.createFieldSet("Paramètres du filtre "+effect.getName());frameElt.style.marginTop="1em";configElt.appendChild(frameElt);frameElt.appendChild(effect.getConfigFrame
(JSUtils.makeCallback(this,IDM.Product.ImageFXDialog.prototype._onConfigFrameUpdated,effect)));return false},_onCheckedItem:function(checkElt,itemElt,ev){DOMEventUtils.stopPropagation(ev);this._onClickedItem(itemElt,ev);var effect=itemElt.getElement().m_effect;this._swapEffect(effect);return true},_swapEffect:function(effect){if(this.m_effects.hasEffect(effect))
this._disableEffect(effect);else
this._enableEffect(effect)},_enableEffect:function(effect){this.m_effects.addEffect(effect);var checkElt=effect.m_checkElt.getElement();checkElt.defaultChecked=checkElt.checked=true;this._updatePreview()},_disableEffect:function(effect){this.m_effects.removeEffect(effect);var checkElt=effect.m_checkElt.getElement();checkElt.defaultChecked=checkElt.checked=false;this._updatePreview()},_onConfigFrameUpdated:function(effect){this._enableEffect(effect);this._updatePreview()},_updatePreview:function(){var imgElt=this.m_previewImgElt.getElement();var previewElt=this.m_previewElt.getElement();var previewSize=HTMLUtils.getElementSize(previewElt);previewSize.width-=50;previewSize.height-=50;this.getNamedSlot("effects-changed").trigger(this,previewSize,imgElt)}}});IDM.Product.InPlaceTextEditor=Class.define
({ctor:function(text,rect){IDM.Product.InPlaceTextEditor.baseConstructor.call(this);this.m_text=text;this.m_rect=rect;this.m_oldDocKeyDown=null;this.m_oldDocKeyUp=null;this.m_oldDocKeyPress=null;this.m_editor=null;this.m_focusLayer=null;this.declareSlot("text-changed")},inherits:IDM.Object,prototype:{startEditing:function(){this.m_oldDocKeyDown=document.onkeydown;document.onkeydown=null;this.m_oldDocKeyUp=document.onkeyup;document.onkeyup=null;this.m_oldDocKeyPress=document.onkeypress;document.onkeypress=null;var focusLayerElt=document.createElement("div");document.body.appendChild(focusLayerElt);focusLayerElt.style.position="absolute";focusLayerElt.onmousedown=JSUtils.makeCallback(this,IDM.Product.InPlaceTextEditor.prototype._onBlurEditor);HTMLUtils.setElementPos(focusLayerElt,new Point(0,0));HTMLUtils.setElementSize(focusLayerElt,HTMLUtils.getDocumentSize());var elt=document.createElement("textarea");document.body.appendChild(elt);elt.style.position="absolute";elt.style.border="1px solid #606060";elt.style.backgroundColor="#ffffff";elt.style.fontFamily="sans-serif";elt.style.fontSize="8pt";elt.value=this.m_text;elt.onblur=JSUtils.makeCallback(this,IDM.Product.InPlaceTextEditor.prototype._onBlurEditor);var size=this.m_rect.getSize();size.width=Math.max(size.width,200);size.height=Math.max(size.height,40);HTMLUtils.setElementPos(elt,this.m_rect.getOrigin());HTMLUtils.setElementSize(elt,size);elt.focus();this.m_focusLayer=NodeRef.create(focusLayerElt);this.m_editor=NodeRef.create(elt)},_onBlurEditor:function(){if(this.m_editor){var elt=this.m_editor.getElement();this.getNamedSlot("text-changed").trigger(elt.value);if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_SAFARI){elt.style.visibility="hidden";elt.style.position="absolute";elt.style.left=elt.style.top="-10000px"}else
{elt.parentNode.removeChild(elt)}
var layerElt=this.m_focusLayer.getElement();layerElt.parentNode.removeChild(layerElt);this.m_editor=null;this.m_focusLayer=null}
if(this.m_oldDocKeyDown)document.onkeydown=this.m_oldDocKeyDown;if(this.m_oldDocKeyUp)document.onkeyup=this.m_oldDocKeyUp;if(this.m_oldDocKeyPress)document.onkeypress=this.m_oldDocKeyPress}}});IDM.Upload={};IDM.Upload.AppletListener=function(){}
IDM.Upload.AppletListener.prototype.initApplet=function(){}
IDM.Upload.AppletListener.g_currentListener=null;IDM.Upload.AppletListener.mapToObject=function(lst){IDM.Upload.AppletListener.g_currentListener=lst}
function AppletListener_initApplet(){if(IDM.Upload.AppletListener.g_currentListener)
IDM.Upload.AppletListener.g_currentListener.initApplet()}
IDM.Upload.SecurityListener=function(){}
IDM.Upload.SecurityListener.prototype.notAllowed=function(){}
IDM.Upload.SecurityListener.g_currentListener=null;IDM.Upload.SecurityListener.mapToObject=function(lst){IDM.Upload.SecurityListener.g_currentListener=lst}
function SecurityListener_notAllowed(){if(IDM.Upload.SecurityListener.g_currentListener)
IDM.Upload.SecurityListener.g_currentListener.notAllowed()}
IDM.Upload.UploadListener=function(){}
IDM.Upload.UploadListener.REASON_OTHER=0;IDM.Upload.UploadListener.REASON_QUOTA=1;IDM.Upload.UploadListener.REASON_NOT_LOGGED_IN=2;IDM.Upload.UploadListener.prototype={uploadStarted:function(fileCount){},uploadCancelled:function(){},uploadFailed:function(reason){},uploadFinished:function(){}};IDM.Upload.UploadListener.g_currentListener=null;IDM.Upload.UploadListener.mapToObject=function(lst){IDM.Upload.UploadListener.g_currentListener=lst}
function UploadListener_uploadStarted(fileCount){if(IDM.Upload.UploadListener.g_currentListener)
IDM.Upload.UploadListener.g_currentListener.uploadStarted(fileCount)}
function UploadListener_uploadCancelled(){if(IDM.Upload.UploadListener.g_currentListener)
IDM.Upload.UploadListener.g_currentListener.uploadCancelled()}
function UploadListener_uploadFailed(reason){if(IDM.Upload.UploadListener.g_currentListener)
IDM.Upload.UploadListener.g_currentListener.uploadFailed(reason)}
function UploadListener_uploadFinished(){if(IDM.Upload.UploadListener.g_currentListener)
IDM.Upload.UploadListener.g_currentListener.uploadFinished()}
IDM.Upload.UploadProgressListener=function(){}
IDM.Upload.UploadProgressListener.prototype={fileChanged:function(fileName,fileIndex,fileCount,photoId){},fileProgressChanged:function(currentBytes,totalBytes){},overallProgressChanged:function(currentBytes,totalBytes){}};IDM.Upload.UploadProgressListener.g_currentListener=null;IDM.Upload.UploadProgressListener.mapToObject=function(lst){IDM.Upload.UploadProgressListener.g_currentListener=lst}
function UploadProgressListener_fileChanged(fileName,fileIndex,fileCount,photoId){if(IDM.Upload.UploadProgressListener.g_currentListener)
IDM.Upload.UploadProgressListener.g_currentListener.fileChanged(fileName,fileIndex,fileCount,photoId)}
function UploadProgressListener_fileProgressChanged(currentBytes,totalBytes){if(IDM.Upload.UploadProgressListener.g_currentListener)
IDM.Upload.UploadProgressListener.g_currentListener.fileProgressChanged(currentBytes,totalBytes)}
function UploadProgressListener_overallProgressChanged(currentBytes,totalBytes){if(IDM.Upload.UploadProgressListener.g_currentListener)
IDM.Upload.UploadProgressListener.g_currentListener.overallProgressChanged(currentBytes,totalBytes)}
IDM.Upload.JavaUploadDialog=Class.define
({ctor:function(destAlbumId,mediumSize,goodSize){IDM.Upload.JavaUploadDialog.baseConstructor.call(this);this.setTitle("Envoi de photos");this.setButtons([new IDM.Dialog.Button("Envoyer",10),IDM.Dialog.Button.CLOSE]);this.m_onUploadFinishedCallback=null;this.m_destAlbumId=destAlbumId;this.m_mediumSize=mediumSize;this.m_goodSize=goodSize;if(mediumSize==null||goodSize==null){var dpi=IDM.Configuration.getParam("product.pm.dpi.max");var widthMm=200;var heightMm=200;var widthPx=(widthMm*dpi)/25.4;var heightPx=(heightMm*dpi)/25.4;goodSize=Math.round(widthPx*heightPx);mediumSize=Math.round(goodSize*0.8)}
this.m_appletId="Envoi_de_fichiers";this.m_applet=null;this.m_archive="com.idmagic.tools.uploader.jar";this.m_class="com.idmagic.tools.uploader.UploaderApplet";this.m_codeBase="/modules/upload/packages/";this.m_params=[];this.m_params["mayscript"]="true";this.m_params["progressbar"]="true";if(JSUtils.isDebug()){this.m_params["debug"]="true";this.m_params["test-mode"]="true"}
this.m_params["mode"]="extended";this.m_params["cookie"]=IDM.Configuration.getParam("document.cookie");this.m_params["action.post-url"]=IDM.Configuration.getParam("server.url.base")+"/modules/upload/services/upload-photos.php";this.m_params["listener.applet.initApplet"]="AppletListener_initApplet";this.m_params["listener.security.notAllowed"]="SecurityListener_notAllowed";this.m_params["listener.upload.uploadStarted"]="UploadListener_uploadStarted";this.m_params["listener.upload.uploadCancelled"]="UploadListener_uploadCancelled";this.m_params["listener.upload.uploadFailed"]="UploadListener_uploadFailed";this.m_params["listener.upload.uploadFinished"]="UploadListener_uploadFinished";this.m_params["listener.upload-progress.fileChanged"]="UploadProgressListener_fileChanged";this.m_params["listener.upload-progress.fileProgressChanged"]="UploadProgressListener_fileProgressChanged";this.m_params["listener.upload-progress.overallProgressChanged"]="UploadProgressListener_overallProgressChanged";this.m_params["image.medium-size"]=mediumSize;this.m_params["image.good-size"]=goodSize;this.m_params["image.resize-pixels"]=IDM.Configuration.getParam("image.upload.max-pixels");this.m_params["action.param.1.name"]="album";this.m_params["action.param.1.value"]=destAlbumId;this.m_params["action.param.2.name"]="session-id";this.m_params["action.param.2.value"]=IDM.Configuration.getParam("document.session-id");var styleElt=document.createElement("div");styleElt.style.left="-10000px";styleElt.style.top="-10000px";styleElt.style.visibility="hidden";styleElt.className="idm-uploaddialogapplet";document.body.appendChild(styleElt);var listStyleElt=document.createElement("div");listStyleElt.className="list";styleElt.appendChild(listStyleElt);this.m_params["ui.background.color"]=CSSUtils.parseColor(HTMLUtils.getCurrentStyle(styleElt,"background-color")).toHex();this.m_params["ui.drop.color"]=CSSUtils.parseColor(HTMLUtils.getCurrentStyle(styleElt,"color")).toHex();this.m_params["ui.drop.image"]=CSSUtils.parseImage(HTMLUtils.getCurrentStyle(styleElt,"background-image"));this.m_params["ui.border.color"]=CSSUtils.parseColor(HTMLUtils.getCurrentStyle(styleElt,"border-top-color")).toHex();this.m_params["ui.border.width"]=parseInt(HTMLUtils.getCurrentStyle(styleElt,"border-top-width"));this.m_params["ui.list.background.color"]=CSSUtils.parseColor(HTMLUtils.getCurrentStyle(listStyleElt,"background-color")).toHex();this.m_params["ui.list.background.image"]=CSSUtils.parseImage(HTMLUtils.getCurrentStyle(listStyleElt,"background-image"));this.m_params["text.drop"]="Glissez et déposez vos photos ici";this.m_params["text.error.format.intro"]="Le ou les fichiers suivants n'ont pas pu être ajoutés car leur format n'est pas reconnu.##LF##Seules les images au format JPEG ou PNG sont acceptées.";this.m_params["text.error.format.title"]="Format d'image incorrect";this.m_params["text.delete.confirm.text"]="Retirer cette photo ?";this.m_params["text.delete.confirm.title"]="Question";this.m_params["text.error.access-denied.text"]="Pour pouvoir procéder à l'envoi de vos photos, il faut impérativement accepter l'exécution de l'application.##LF####LF##Veuillez fermer votre navigateur et le relancer, puis lorsqu'il vous sera demandé##LF##de lancer l'application, cliquez sur \u00ABExécuter\u00BB.";this.m_params["text.error.access-denied.title"]="Permission refusée";this.m_params["text.dir-list.home"]="Mon répertoire personnel";this.m_params["text.dir-list.computer"]="Mon ordinateur";this.m_params["text.upload-list.button.add"]="Ajouter";this.m_params["text.upload-list.button.remove"]="Enlever";this.m_params["text.upload-list.button.add-all"]="Ajouter tout";this.m_params["text.upload-list.button.remove-all"]="Enlever tout";this.m_params["text.upload-list.no-files"]="Cette zone contient les images à télécharger dans votre photothèque.";this.m_params["text.upload-list.legend.label"]="Légende : ";this.m_params["text.upload-list.legend.bad-quality"]="Qualité insuffisante";this.m_params["text.upload-list.legend.medium-quality"]="Qualité satisfaisante";this.m_params["text.upload-list.legend.good-quality"]="Très bonne qualité";this.m_params["text.file-list.no-files"]="Sélectionnez un répertoire pour voir les images qu'il contient.";var appletSize=HTMLUtils.getElementSize(styleElt);var bodySize=HTMLUtils.getWindowInnerSize();if(HTMLUtils.getCurrentStyle(styleElt,"position")=="relative"){appletSize.width=Math.max(500,Math.min(1200,Math.round(bodySize.width*0.85)));appletSize.height=Math.max(300,Math.min(800,Math.round(bodySize.height-200)))}
this.m_appletSize=appletSize;this.m_introElt=null;styleElt.parentNode.removeChild(styleElt);styleElt=null;IDM.Upload.SecurityListener.mapToObject(this);IDM.Upload.AppletListener.mapToObject(this)},inherits:IDM.Dialog,prototype:{_constructInner:function(contElt,boxElt){contElt.className+=" idm-uploaddialog idm-uploaddialog-extended";var introElt=document.createElement("p");introElt.className="intro";introElt.style.visibility="hidden";introElt.style.position="relative";boxElt.appendChild(introElt);introElt.innerHTML="S\u00E9lectionnez les photos \u00E0 t\u00E9l\u00E9charger, "
+"puis cliquez sur <strong>Envoyer</strong> pour d\u00E9marrer l'envoi.<br/>"
+"Seules les images au format <strong>JPEG</strong> ou <strong>PNG</strong> sont accept\u00E9es.";this.m_introElt=NodeRef.create(introElt);var simpleBtn=HTMLUtils.createButton("Un problème ? Utilisez le téléchargement classique");simpleBtn.onclick=JSUtils.makeCallback(this,IDM.Upload.JavaUploadDialog.prototype._onClickedSimple);simpleBtn.style.position="absolute";simpleBtn.style.top="0px";simpleBtn.style.right="0px";introElt.insertBefore(simpleBtn,introElt.firstChild);var appletWidth=this.m_appletSize.width;var appletHeight=this.m_appletSize.height;var appletHtml="";if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_SAFARI||JSUtils.getNavigator()==JSUtils.NAVIGATOR_CHROME){appletHtml+='<applet id="'+this.m_appletId+'" name="'+this.m_appletId+'" archive="'+this.m_archive+'" code="'+this.m_class+'" width="'+appletWidth+'" height="'+appletHeight+'" mayscript="true" scriptable="true" style="position: absolute; left: 0px; top: 0px">';appletHtml+='<param name="codebase" value="'+this.m_codeBase+'"/>';appletHtml+='<param name="JAVA_CODEBASE" value="'+this.m_codeBase+'"/>';for(p in this.m_params){var value=JSUtils.toString(this.m_params[p]);value=StringUtils.encodeUTF8(value);value="b64*"+StringUtils.encodeBase64(value);appletHtml+='<param name="'+StringUtils.escapeXML(p)+'"'
+' value="'+StringUtils.escapeXML(value)+'"/>'}
appletHtml+="<p>Impossible de charger l'applet Java.<br/>"
+"Vous devez <a href=\"http://java.sun.com/products/plugin/downloads/index.html\">"
+"installer la derni\u00E8re version du plugin Java</a> pour pouvoir utiliser "
+"cette application.</p><p>Une fois que vous aurez install\u00E9 Java, n'oubliez pas de fermer "
+"puis de redémarrer votre navigateur Internet.</p>";appletHtml+='</applet>'}else if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_IE){appletHtml+='<object id="'+this.m_appletId+'" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="'+appletWidth+'" height="'+appletHeight+'" mayscript="true" style="position: absolute; left: 0px; top: 0px" codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0_11-windows-i586.cab">';appletHtml+='<param name="codebase" value="'+this.m_codeBase+'"/>';appletHtml+='<param name="code" value="'+this.m_class+'"/>';appletHtml+='<param name="archive" value="'+this.m_archive+'"/>';for(p in this.m_params){var value=JSUtils.toString(this.m_params[p]);value=StringUtils.encodeUTF8(value);appletHtml+='<param name="'+StringUtils.escapeXML(p)+'"'
+' value="'+StringUtils.escapeXML(value)+'"/>'}
appletHtml+='</object>'}else
{appletHtml+='<object id="'+this.m_appletId+'" classid="java:'+this.m_class+'.class" type="application/x-java-applet" archive="'+this.m_archive+'" codebase="'+this.m_codeBase+'" width="'+appletWidth+'" height="'+appletHeight+'" mayscript="true" style="position: absolute; left: 0px; top: 0px">';appletHtml+='<param name="archive" value="'+this.m_archive+'"/>';for(p in this.m_params){var value=JSUtils.toString(this.m_params[p]);value=StringUtils.encodeUTF8(value);value="b64*"+StringUtils.encodeBase64(value);appletHtml+='<param name="'+StringUtils.escapeXML(p)+'"'
+' value="'+StringUtils.escapeXML(value)+'"/>'}
appletHtml+="<p>Impossible de charger l'applet Java.<br/>"
+"Vous devez <a href=\"http://java.sun.com/products/plugin/downloads/index.html\">"
+"installer la derni\u00E8re version du plugin Java</a> pour pouvoir utiliser "
+"cette application.</p><p>Une fois que vous aurez install\u00E9 Java, n'oubliez pas de fermer "
+"puis de redémarrer votre navigateur Internet.</p>";appletHtml+='</object>'}
var appletContElt=document.createElement("div");boxElt.appendChild(appletContElt);appletContElt.style.width=appletWidth+"px";appletContElt.style.height=appletHeight+"px";appletContElt.style.position="relative";appletContElt.style.overflow="hidden";var appletWaitElt=document.createElement("div");appletContElt.appendChild(appletWaitElt);appletWaitElt.style.width=appletWidth+"px";appletWaitElt.style.height="auto";appletWaitElt.style.position="absolute";appletWaitElt.style.textAlign="center";appletWaitElt.style.paddingTop="150px";appletWaitElt.style.top="0px";appletWaitElt.style.left="0px";HTMLUtils.setElementText(appletWaitElt,"Veuillez patienter quelques instants...");var appletElt=document.createElement("div");appletContElt.appendChild(appletElt);appletElt.style.width=appletWidth+"px";appletElt.style.height=appletHeight+"px";appletElt.style.position="absolute";if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_SAFARI){appletElt.style.left="0px";appletElt.style.top="0px"}else
{appletElt.style.left="-10000px";appletElt.style.top="-10000px"}
this.m_appletHtml=appletHtml;this.m_appletElt=NodeRef.create(appletElt);var simpleElt=document.createElement("div");appletContElt.appendChild(simpleElt);simpleElt.style.position="absolute";simpleElt.style.width=appletWidth+"px";simpleElt.style.height="auto";simpleElt.style.left="0px";simpleElt.style.top="230px";simpleElt.style.textAlign="center";var simpleSpanElt=document.createElement("span");simpleElt.appendChild(simpleSpanElt);HTMLUtils.setElementText(simpleSpanElt,"Rien ne s'affiche après une minute ? ");simpleElt.appendChild(document.createElement("br"));var simpleAElt=document.createElement("a");simpleElt.appendChild(simpleAElt);simpleAElt.href="#";simpleAElt.onclick=JSUtils.makeCallback(this,IDM.Upload.JavaUploadDialog.prototype._onClickedSimple);HTMLUtils.setElementText(simpleAElt,"Cliquez ici pour utiliser le système d'envoi classique.");this.m_simpleElt=NodeRef.create(simpleElt)},_onShow:function(){JSUtils.invokeLater(JSUtils.makeCallback(this,IDM.Upload.JavaUploadDialog.prototype._loadApplet))},_onClickedSimple:function(){var dlg=new IDM.Upload.SimpleUploadDialog(this.m_destAlbumId,this.m_mediumSize,this.m_goodSize);dlg.setOnUploadFinishedCallback(this.m_onUploadFinishedCallback);dlg.show();this.close()},_loadApplet:function(){this.m_appletElt.getElement().innerHTML=this.m_appletHtml},getApplet:function(){if(this.m_applet==null)
this.m_applet=NodeRef.create(document.getElementById(this.m_appletId));return this.m_applet.getElement()},setOnUploadFinishedCallback:function(callback){this.m_onUploadFinishedCallback=callback},_onClickedButton:function(btn){if(btn.getId()==10){try
{IDM.Upload.UploadListener.mapToObject(this);this.getApplet().upload()}
catch(e){}
return false}else
{if(this.getApplet().getUploadFileCount()!=0){if(confirm("Il reste des fichiers non envoyés.\nVoulez-vous les envoyer maintenant ?")){IDM.Upload.UploadListener.mapToObject(this);this.getApplet().upload();return false}}
this.getApplet().parentNode.removeChild(this.getApplet());this.m_applet=null;return true}},uploadStarted:function(fileCount){this._showApplet(false);this.m_progressDialog=new IDM.Upload.JavaUploadDialog.ProgressDialog(this,this.getApplet(),fileCount);this.m_progressDialog.show()},uploadCancelled:function(){this._showApplet(true);this.m_progressDialog.close();this.m_progressDialog=null},uploadFailed:function(reason){this._showApplet(true);this.m_progressDialog.close();this.m_progressDialog=null;var msg="";switch(parseInt(reason)){case IDM.Upload.UploadListener.REASON_NOT_LOGGED_IN:msg="Il semblerait qu'un pare-feu ou un anti-virus bloque la connexion \u00E0 notre serveur.\n\n"
+"Nous vous invitons \u00E0 v\u00E9rifier la configuration de votre pare-feu et/ou anti-virus\n"
+"puis \u00E0 recommencer l'envoi de vos photos.";break;case IDM.Upload.UploadListener.REASON_QUOTA:msg="Vous avez atteint le quota maximum pour vos photos.\n\nSupprimez une ou plusieurs photos de vos anciennes photot\u00E8ques\navant d'en envoyer de nouvelles.";break;default:case IDM.Upload.UploadListener.REASON_OTHER:msg="Une erreur est survenue lors de l'envoi d'une ou plusieurs photos.\nVeuillez r\u00E9essayer un peu plus tard...";break}
alert(msg)},uploadFinished:function(){JSUtils.invokeLater(JSUtils.makeCallback(this,IDM.Upload.JavaUploadDialog.prototype.uploadFinishedImpl))},uploadFinishedImpl:function(){this.m_progressDialog.close();this.m_progressDialog=null;this.close();if(this.m_onUploadFinishedCallback)
this.m_onUploadFinishedCallback()},notAllowed:function(){alert(StringUtils.replaceString(this.m_params["text.error.access-denied.text"],"##LF##","\n"));JSUtils.invokeLater(JSUtils.makeCallback(this,IDM.Upload.JavaUploadDialog.prototype.close))},initApplet:function(){if(this.m_introElt!=null&&this.m_introElt.getElement()!=null)
this.m_introElt.getElement().style.visibility="";this._showApplet(true)},_showApplet:function(show){var appletElt=this.m_appletElt.getElement();if(appletElt!=null){if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_SAFARI){appletElt.style.left=appletElt.style.top="0px";appletElt.style.visibility=(show?"visible":"hidden")}else
{appletElt.style.left=appletElt.style.top=(show?"0px":"-10000px")}
if(show)
this.getApplet().refresh()}}}});IDM.Upload.UploadDialog=Class.define
({ctor:function(destAlbumId,mediumSize,goodSize){IDM.Upload.UploadDialog.baseConstructor.call(this);this.setTitle("Envoi de photos");this.setButtons([IDM.Dialog.Button.CANCEL]);this.m_onUploadFinishedCallback=null;this.m_destAlbumId=destAlbumId;this.m_mediumSize=mediumSize;this.m_goodSize=goodSize},inherits:IDM.Dialog,prototype:{_constructInner:function(contElt,boxElt){contElt.className+=" idm-uploaddialog-choosemode";var introElt=document.createElement("p");introElt.className="intro";boxElt.appendChild(introElt);introElt.innerHTML="Choisissez une méthode d'envoi des photos.";var btnContElt=document.createElement("div");btnContElt.className="modes";boxElt.appendChild(btnContElt);var javaBtnElt=HTMLUtils.createButton("Téléchargement rapide (Java)",JSUtils.makeCallback(this,IDM.Upload.UploadDialog.prototype._onClickedJavaUpload));HTMLUtils.addStyleClass(javaBtnElt,"extended-upload");btnContElt.appendChild(javaBtnElt);var simpleBtnElt=HTMLUtils.createButton("Téléchargement classique",JSUtils.makeCallback(this,IDM.Upload.UploadDialog.prototype._onClickedSimpleUpload));HTMLUtils.addStyleClass(simpleBtnElt,"simple-upload");btnContElt.appendChild(simpleBtnElt)},_onClickedButton:function(btn){return true},setOnUploadFinishedCallback:function(callback){this.m_onUploadFinishedCallback=callback},_onClickedJavaUpload:function(){var dlg=new IDM.Upload.JavaUploadDialog(this.m_destAlbumId,this.m_mediumSize,this.m_goodSize);dlg.setOnUploadFinishedCallback(this.m_onUploadFinishedCallback);dlg.show();this.close()},_onClickedSimpleUpload:function(){var dlg=new IDM.Upload.SimpleUploadDialog(this.m_destAlbumId,this.m_mediumSize,this.m_goodSize);dlg.setOnUploadFinishedCallback(this.m_onUploadFinishedCallback);dlg.show();this.close()}}});if(!IDM.Configuration.getParam("image.upload.show-mode-selection"))
IDM.Upload.UploadDialog=IDM.Upload.JavaUploadDialog;IDM.Upload.JavaUploadDialog.ProgressDialog=Class.define
({ctor:function(parentDlg,applet,fileCount){IDM.Upload.JavaUploadDialog.ProgressDialog.baseConstructor.call(this);this.setTitle("Envoi des photos en cours...");this.setButtons([IDM.Dialog.Button.CANCEL]);this.m_parentDlg=parentDlg;this.m_applet=applet;this.m_overallProgressBar=null;this.m_overallPctElt=null;this.m_overallCurrentElt=null;this.m_overallTotalElt=null;this.m_overallCurrentFileElt=null;this.m_overallTotalFileElt=null;this.m_fileCount=fileCount;this.m_curFileIndex=0;this.m_etaStart=0;this.m_etaPrevComputation=0;this.m_etaElt=null;this.m_statusUploadingElt=null;this.m_statusResizingElt=null;this.m_imageDownloaded=null;IDM.Upload.UploadProgressListener.mapToObject(this)},inherits:IDM.Dialog,prototype:{_constructInner:function(contElt,boxElt){contElt.className+=" idm-uploadprogressdialog";var div,textElt;div=document.createElement("div");div.className="total-transfer";div.style.visibility="hidden";boxElt.appendChild(div);this.m_statusUploadingElt=NodeRef.create(div);textElt=document.createElement("span");HTMLUtils.setElementText(textElt,StringUtils.noBreakSpace("Transfert total : "));div.appendChild(textElt);textElt=document.createElement("span");HTMLUtils.setElementText(textElt,"\u00A0");div.appendChild(textElt);this.m_overallCurrentElt=NodeRef.create(textElt);div.appendChild(document.createTextNode(" / "));textElt=document.createElement("span");HTMLUtils.setElementText(textElt,"\u00A0");div.appendChild(textElt);this.m_overallTotalElt=NodeRef.create(textElt);textElt=document.createElement("span");HTMLUtils.setElementText(textElt,StringUtils.noBreakSpace("  (photo "));div.appendChild(textElt);textElt=document.createElement("span");HTMLUtils.setElementText(textElt,"\u00A0");div.appendChild(textElt);this.m_overallCurrentFileElt=NodeRef.create(textElt);div.appendChild(document.createTextNode(" / "));textElt=document.createElement("span");HTMLUtils.setElementText(textElt,"\u00A0");div.appendChild(textElt);this.m_overallTotalFileElt=NodeRef.create(textElt);div.appendChild(document.createTextNode(")"));div=document.createElement("div");div.className="total-transfer";div.style.display="none";boxElt.appendChild(div);HTMLUtils.setElementText(div,StringUtils.noBreakSpace("Attente du serveur..."));this.m_statusResizingElt=NodeRef.create(div);textElt=document.createElement("span");this.m_overallProgressBar=IDM.ProgressBar.create(boxElt);this.m_overallProgressBar.getElement().style.width="350px";div=document.createElement("div");div.className="remaining-time";boxElt.appendChild(div);textElt=document.createElement("span");HTMLUtils.setElementText(textElt,StringUtils.noBreakSpace("Temps restant : "));div.appendChild(textElt);textElt=document.createElement("span");HTMLUtils.setElementText(textElt,"\u00A0");div.appendChild(textElt);this.m_etaElt=NodeRef.create(textElt);var divImage=document.createElement("div");divImage.style.width="150px";divImage.style.height="100px";divImage.style.marginLeft="120px";var imgElt=document.createElement("img");divImage.appendChild(imgElt);imgElt.align="absmiddle";imgElt.style.visibility="visible";imgElt.src="/styles/default/images/page/ajax-loader.gif";this.m_imageDownloaded=imgElt;boxElt.appendChild(divImage)},_onClickedButton:function(btn){this.m_applet.cancelUpload();return false},fileChanged:function(fileName,fileIndex,fileCount,photoId){if(this.m_imageDownloaded!=null){this.m_imageDownloaded.src="/photo.php?id="+photoId+"&size=4&rand="+Math.round(Math.random()*100000)}
this.m_overallProgressBar.setMode(IDM.ProgressBar.MODE_INFINITE);this.m_fileCount=parseInt(fileCount);this.m_curFileIndex=parseInt(fileIndex);this.m_statusUploadingElt.getElement().style.display="none";this.m_statusUploadingElt.getElement().style.visibility="";this.m_statusResizingElt.getElement().style.display=""},fileProgressChanged:function(currentBytes,totalBytes){if(currentBytes>=totalBytes){this.m_statusUploadingElt.getElement().style.display="none";this.m_statusResizingElt.getElement().style.display="";this.m_overallProgressBar.setMode(IDM.ProgressBar.MODE_INFINITE)}else if(currentBytes>=20*1024){this.m_statusUploadingElt.getElement().style.display="";this.m_statusResizingElt.getElement().style.display="none";this.m_overallProgressBar.setMode(IDM.ProgressBar.MODE_NORMAL)}},overallProgressChanged:function(currentBytes,totalBytes){this.m_overallProgressBar.setRange(0,totalBytes);this.m_overallProgressBar.setValue(currentBytes);HTMLUtils.setElementText(this.m_overallCurrentElt.getElement(),StringUtils.formatByteSize(currentBytes));HTMLUtils.setElementText(this.m_overallTotalElt.getElement(),StringUtils.formatByteSize(totalBytes));HTMLUtils.setElementText(this.m_overallCurrentFileElt.getElement(),this.m_curFileIndex+1);HTMLUtils.setElementText(this.m_overallTotalFileElt.getElement(),this.m_fileCount);this._updateETA(currentBytes,totalBytes)},_updateETA:function(currentBytes,totalBytes){if(JSUtils.currentTimeMillis()-this.m_etaPrevComputation<1000)
return;var eta=0;var bytesPerSec=0;if(this.m_etaStart==0){this.m_etaStart=JSUtils.currentTimeMillis()}else if(currentBytes>300*1024){var elapsedTime=(JSUtils.currentTimeMillis()-this.m_etaStart)/1000.0;bytesPerSec=Math.floor(currentBytes/elapsedTime)*1.0;eta=(totalBytes-currentBytes)/bytesPerSec}
var etaStr=StringUtils.formatDuration(eta);if(bytesPerSec!=0)
etaStr+=" (débit : "+StringUtils.formatByteSize(bytesPerSec)+")";if(eta!=0)
HTMLUtils.setElementText(this.m_etaElt.getElement(),etaStr);else
HTMLUtils.setElementText(this.m_etaElt.getElement(),"calcul en cours...");this.m_etaPrevComputation=JSUtils.currentTimeMillis()}}});IDM.Upload.SimpleUploadDialog=Class.define
({ctor:function(destAlbumId,mediumSize,goodSize,fileCount){IDM.Upload.SimpleUploadDialog.baseConstructor.call(this);this.setButtons([new IDM.Dialog.Button("Envoyer",10),IDM.Dialog.Button.CANCEL]);this.m_onUploadFinishedCallback=null;this.m_destAlbumId=destAlbumId;this.m_mediumSize=mediumSize;this.m_goodSize=goodSize;this.m_fileCount=((fileCount&&fileCount>0)?fileCount:10);if(this.m_fileCount==1)
this.setTitle("Envoi d'une photo");else
this.setTitle("Envoi de photos");this.m_progressDlg=null},inherits:IDM.Dialog,prototype:{_constructInner:function(contElt,boxElt){contElt.className+=" idm-uploaddialog idm-uploaddialog-simple";var introElt=document.createElement("p");introElt.className="intro";boxElt.appendChild(introElt);introElt.innerHTML="Cliquez sur le bouton <strong>Parcourir</strong> pour sélectionner un fichier.<br/>"
+"Pour démarrer le téléchargement, cliquez sur <strong>Envoyer</strong>.<br/><br/>"
+"Attention, seuls les fichiers au format <strong>JPEG</strong> ou <strong>PNG</strong> sont acceptés.";var boxContElt=document.createElement("div");boxContElt.className="container";boxContElt.style.position="relative";boxContElt.style.width=(this.m_fileCount>=7?"640px":"370px");boxContElt.style.height=(Math.ceil(this.m_fileCount*0.5)*40)+"px";boxElt.appendChild(boxContElt);var waitElt=document.createElement("div");waitElt.className="wait";waitElt.style.position="absolute";waitElt.style.left="0px";waitElt.style.top="0px";waitElt.style.width=boxContElt.style.width;waitElt.style.height=boxContElt.style.height;waitElt.style.visibility="hidden";boxContElt.appendChild(waitElt);var frameElt=document.createElement("iframe");frameElt.className="frame";frameElt.style.position="absolute";frameElt.style.left="0px";frameElt.style.top="0px";frameElt.style.borderWidth="0px";frameElt.style.width=boxContElt.style.width;frameElt.style.height=boxContElt.style.height;frameElt.style.visibility="hidden";frameElt.style.marginTop="1em";frameElt.border="0";frameElt.frameBorder="0";frameElt.marginWidth=frameElt.marginHeight="0";frameElt.scrolling="no";frameElt.id=frameElt.name=HTMLUtils.generateUniqueId();boxContElt.appendChild(frameElt);var frame=document.getElementById(frameElt.name);var frameDoc=frame.contentWindow||frame.contentDocument;if(frameDoc.document)
frameDoc=frameDoc.document
frameDoc.open();frameDoc.write('<html><head><title>UPLOAD</title></head><body style="margin: 0px; padding: 0px"></body></html>');frameDoc.close();var headElt=frameDoc.getElementsByTagName("head")[0];var bodyElt=frameDoc.body;var topHeadElt=document.getElementsByTagName("head")[0];var linkElts=topHeadElt.getElementsByTagName("link");for(var i=0,n=linkElts.length;i<n;++i){var linkElt=linkElts[i];if(linkElt.rel!="stylesheet")continue;try{headElt.appendChild(HTMLUtils.importNode(frameDoc,linkElt,true))}catch(e){}}
bodyElt.className="idm-window idm-uploaddialog-simple-form";bodyElt.style.borderWidth="0px";var frameContElt=frameDoc.createElement("div");frameContElt.className="idm-window";frameContElt.style.borderWidth="0px";frameContElt.style.width=boxContElt.style.width;bodyElt.appendChild(frameContElt);var formElt=frameDoc.createElement("form");formElt.action="/modules/upload/services/upload-photos.php";formElt.method="post";formElt.enctype=formElt.encoding="multipart/form-data";formElt.name=formElt.id=HTMLUtils.generateUniqueId();formElt.style.margin="0px";formElt.style.padding="0px";formElt.style.width=boxContElt.style.width;frameContElt.appendChild(formElt);var fileCount=this.m_fileCount;window.IDMSimpleUploadDialog_finished=JSUtils.makeCallback(this,IDM.Upload.SimpleUploadDialog.prototype._onUploadFinished);formElt.appendChild(HTMLUtils.createHiddenInput("album",this.m_destAlbumId,frameDoc));formElt.appendChild(HTMLUtils.createHiddenInput("session-id",IDM.Configuration.getParam("document.session-id"),frameDoc));formElt.appendChild(HTMLUtils.createHiddenInput("file-count",fileCount,frameDoc));formElt.appendChild(HTMLUtils.createHiddenInput("version","simple/built-in",frameDoc));formElt.appendChild(HTMLUtils.createHiddenInput("js-callback","this.parent.IDMSimpleUploadDialog_finished(g_uploadStatus, g_uploadedPhotos);",frameDoc));for(var i=0;i<fileCount;++i){var fileElt=frameDoc.createElement("div");fileElt.style.cssFloat="left";fileElt.style.display="inline";fileElt.style.height=fileElt.style.lineHeight="40px";fileElt.style.textAlign="center";fileElt.style.whiteSpace="nowrap";var inputElt=frameDoc.createElement("input");inputElt.type="file";inputElt.name="file"+(i+1);inputElt.id=HTMLUtils.generateUniqueId();if(fileCount>2){var labelElt=frameDoc.createElement("label");labelElt.hmtlFor=inputElt.id;labelElt.style.width="2em";HTMLUtils.setElementInlineBlock(labelElt);labelElt.appendChild(frameDoc.createTextNode((i+1)+". "));fileElt.appendChild(labelElt)}
fileElt.appendChild(inputElt);formElt.appendChild(fileElt)}
var clearElt=frameDoc.createElement("div");clearElt.style.clear="both";formElt.appendChild(clearElt);this.m_introElt=NodeRef.create(introElt);this.m_waitElt=NodeRef.create(waitElt);this.m_iframeElt=NodeRef.create(frameElt);this.m_formId=formElt.id},_onShow:function(){var frameElt=this.m_iframeElt.getElement();frameElt.style.visibility=""},_onClickedButton:function(btn){if(btn.getId()==10){var introElt=this.m_introElt.getElement();var waitElt=this.m_waitElt.getElement();var frameElt=this.m_iframeElt.getElement();var frame=window.frames[frameElt.name];var frameDoc=frame.document;var formElt=frameDoc.getElementById(this.m_formId);introElt.style.visibility="hidden";waitElt.style.visibility="";formElt.style.visibility="hidden";formElt.submit();var progressDlg=new IDM.Upload.SimpleUploadDialog.ProgressDialog();progressDlg.show();this.m_progressDlg=progressDlg;return false}else
{return true}},setOnUploadFinishedCallback:function(callback){this.m_onUploadFinishedCallback=callback},_onUploadFinished:function(uploadStatus,uploadedPhotos){var tmp=StringUtils.explode(":",uploadStatus);var code=(tmp.length==2?tmp[0]:"ERROR");var detail=(tmp.length==2?tmp[1]:"");if(this.m_progressDlg!=null){this.m_progressDlg.close();this.m_progressDlg=null}
if(code=="OK"){this.close();if(this.m_onUploadFinishedCallback){var callback=JSUtils.makeCallback(null,this.m_onUploadFinishedCallback,uploadedPhotos);window.setTimeout(callback,100)}}else
{var msg="";switch(detail){case"not logged in":msg="Il semblerait qu'un pare-feu ou un anti-virus bloque la connexion \u00E0 notre serveur.\n\n"
+"Nous vous invitons \u00E0 v\u00E9rifier la configuration de votre pare-feu et/ou anti-virus\n"
+"puis \u00E0 recommencer l'envoi de vos photos.";break;case"quota":msg="Vous avez atteint le quota maximum pour vos photos.\n\nSupprimez une ou plusieurs photos de vos anciennes phototh\u00E8ques\navant d'en envoyer de nouvelles.";break;default:msg="Une erreur est survenue lors de l'envoi d'une ou plusieurs photos.\nVeuillez r\u00E9essayer un peu plus tard...";break}
this.close();alert(msg)}}}});IDM.Upload.SimpleUploadDialog.ProgressDialog=Class.define
({ctor:function(){IDM.Upload.SimpleUploadDialog.ProgressDialog.baseConstructor.call(this);this.setTitle("Envoi des photos en cours...");this.setButtons([])},inherits:IDM.Dialog,prototype:{_constructInner:function(contElt,boxElt){contElt.className+=" idm-uploadprogressdialog";var p=document.createElement("p");p.innerHTML="Merci de patienter quelques minutes...<br/>"
+"La durée peut varier selon la vitesse de votre connexion Internet.";boxElt.appendChild(p);var progressBar=IDM.ProgressBar.create(boxElt);progressBar.getElement().style.width="400px";progressBar.setMode(IDM.ProgressBar.MODE_INFINITE)},_onClickedButton:function(btn){return false}}});IDM.Shop=function(id){this.m_id=id}
IDM.Shop.prototype.getId=function(){return this.m_id}
IDM.Shop.prototype.getCheckoutURL=function(){var url=new URL("/shop/shop.php");url=url.addParam("sid",IDM.Shop.getCurrentShop().getId());url=url.addParam("op","checkout");return url}
IDM.Shop.setCurrentShop=function(shop){window.g_shopId=shop.getId()}
IDM.Shop.getCurrentShop=function(){if(window.g_shopId===undefined)
window.g_shopId=0;return new IDM.Shop(g_shopId)}
IDM.Shop.Tracker=function(type,url){this.m_type=type;this.m_url=url}
IDM.Shop.Tracker.TYPE_REGISTRATION=1;IDM.Shop.Tracker.prototype.getType=function(){return this.m_type}
IDM.Shop.Tracker.prototype.getURL=function(){return this.m_url}
IDM.Shop.Tracker.prototype.getTriggerURL=function(p1,p2,p3,p4,p5){if(this.getType()==IDM.Shop.Tracker.TYPE_REGISTRATION){var shopId=p1;var custId=p2;var custEmail=p3;var custFirstName=p4;var custLastName=p5;var url=this.getURL();url=StringUtils.replaceString(url,"{{{ID}}}",custId);url=StringUtils.replaceString(url,"{{{EMAIL}}}",escape(custEmail));url=StringUtils.replaceString(url,"{{{SHOP_ID}}}",shopId);url=StringUtils.replaceString(url,"{{{FIRST_NAME}}}",escape(custFirstName));url=StringUtils.replaceString(url,"{{{LAST_NAME}}}",escape(custLastName));return url}
return"?"}
IDM.Shop.Session=function(xmlDoc,success){this.m_logon=null;this.m_shop=null;this.m_cust=null;this.m_authLinks=null;this.m_credits=null;this.m_pwdRecoType=null;this.m_pwdRecoURL=null;this._init(xmlDoc,success)}
IDM.Shop.Session.PASSWORD_RECOVERY_TYPE_REDIRECTION="redirection";IDM.Shop.Session.PASSWORD_RECOVERY_TYPE_BUILT_IN="built-in";IDM.Shop.Session.s_currentSession=null;IDM.Shop.Session.invalidate=function(){IDM.Shop.Session.s_currentSession=null}
IDM.Shop.Session.get=function(forceUpdate){if(forceUpdate||IDM.Shop.Session.s_currentSession==null){var webs=new IDM.WebService(new URL("/shop/services/session/session.php").addParam("shop",IDM.Shop.getCurrentShop().getId()));if(!webs.call())
IDM.Shop.Session.s_currentSession=new IDM.Shop.Session(null,null);else
IDM.Shop.Session.s_currentSession=new IDM.Shop.Session(webs.getResult(),webs.isSuccess())}
return IDM.Shop.Session.s_currentSession}
IDM.Shop.Session.prototype.isLogon=function(){return this.m_logon}
IDM.Shop.Session.prototype.getTemporaryAlbum=function(){var webs=new IDM.WebService(new URL("/modules/photo/_services/get-temp-album.php"));if(webs.call()&&webs.isSuccess()){var dom=webs.getResult();var albumNode=XMLUtils.getRootElement(dom);return IDM.Album.createFromXML(albumNode)}
return null}
IDM.Shop.Session.prototype.getPasswordRecoveryType=function(){return this.m_pwdRecoType}
IDM.Shop.Session.prototype.getPasswordRecoveryURL=function(){return this.m_pwdRecoURL}
IDM.Shop.Session.prototype.getShopInfos=function(){return this.m_shop}
IDM.Shop.Session.prototype.getCustomerInfos=function(){return this.m_cust}
IDM.Shop.Session.prototype.getAuthLinks=function(){return this.m_authLinks}
IDM.Shop.Session.prototype._update=function(){var webs=new IDM.WebService(new URL("/shop/services/session/session.php").addParam("shop",IDM.Shop.getCurrentShop().getId()));if(!webs.call())
this._init(null,null);else
this._init(webs.getResult(),webs.isSuccess())}
IDM.Shop.Session.prototype._init=function(xmlDoc,success){var sessionNode=(success&&xmlDoc?XMLUtils.getChildByTagName(xmlDoc,"session"):null);if(success&&sessionNode&&sessionNode.getAttribute("logon")=="true"){var shopNode=XMLUtils.getChildByTagName(sessionNode,"shop");this.m_logon=true;this.m_shop={id:parseInt(shopNode.getAttribute("id")),url:XMLUtils.getChildText(shopNode,"url"),name:XMLUtils.getChildText(shopNode,"name"),description:XMLUtils.getChildText(shopNode,"description")};var custNode=XMLUtils.getChildByTagName(sessionNode,"customer");this.m_cust={id:parseInt(custNode.getAttribute("id")),logon:(custNode.getAttribute("logon")=="true"),email:XMLUtils.getChildTextSafe(custNode,"email"),firstName:XMLUtils.getChildByTagName(custNode,"name").getAttribute("first"),lastName:XMLUtils.getChildByTagName(custNode,"name").getAttribute("last"),showName:XMLUtils.getChildByTagName(custNode,"name").getAttribute("show")};var authLinksNode=XMLUtils.getChildByTagName(sessionNode,"auth-links");var linkNodes=XMLUtils.getChildrenByTagName(authLinksNode,"link");this.m_authLinks=[];for(var i=0;i<linkNodes.length;++i){var linkNode=linkNodes[i];this.m_authLinks[i]={id:linkNode.getAttribute("id"),url:linkNode.getAttribute("url"),visible:(linkNode.getAttribute("visible")=="true"),redirect:(linkNode.getAttribute("redirect")=="true"),description:linkNode.getAttribute("description")}}}else
{this.m_logon=false;this.m_shop={id:0,url:"",name:"",description:""};this.m_cust={id:0,logon:false,firstName:"",lastName:"",showName:""};this.m_authLinks=[]}
if(success&&sessionNode){var pwdNode=XMLUtils.getChildByTagName(sessionNode,"password-recovery");this.m_pwdRecoType=pwdNode.getAttribute("type");this.m_pwdRecoURL=(this.m_pwdRecoType==IDM.Shop.Session.PASSWORD_RECOVERY_TYPE_REDIRECTION?URL.parse(pwdNode.getAttribute("url")):null)}}
IDM.Shop.Session.prototype.getCredits=function(){if(this.m_credits)
return this.m_credits;var res=new ArrayList();if(this.m_logon){var webs=new IDM.WebService(new URL("/shop/services/session/credits.php").addParam("sid",IDM.Shop.getCurrentShop().getId()));if(webs.call()&&webs.isSuccess()){var dom=webs.getResult();var rootElt=XMLUtils.getRootElement(dom);var creditElts=XMLUtils.getChildrenElements(rootElt,"credit");var res=new ArrayList();for(var i=0,n=creditElts.length;i<n;++i){var creditElt=creditElts[i];res.add(IDM.Shop.Credit.createFromXML(dom,creditElt))}}}
this.m_credits=res;return res}
IDM.Shop.Session.prototype.signIn=function(email,password,callback){email=StringUtils.trim(JSUtils.toString(email));password=StringUtils.trim(JSUtils.toString(password));if(g_shopConfig["ssl"]){JSUtils.invokeLater(JSUtils.makeCallback(this,IDM.Shop.Session.prototype._signInSecure,email,password,callback));return null}else
{var websURL=new URL(IDM.Configuration.getParam("server.url.base")
+"/shop/services/session/signin.php").addParam("shop",IDM.Shop.getCurrentShop().getId()).addParam("email",StringUtils.encodeUTF8(email)).addParam("password",StringUtils.encodeUTF8(password));var webs=new IDM.WebService(websURL);webs.call();if(webs.isSuccess()){this._update();return true}else
{return false}}}
IDM.Shop.Session.prototype.logout=function(){var webs=new IDM.WebService(new URL("/shop/services/session/logout.php"));webs.call();if(webs.isSuccess()){this._init(null,null);return true}else
{return false}}
IDM.Shop.Session.prototype._signInSecure=function(email,password,callback){var frameElt=document.createElement("iframe");frameElt.id=frameElt.name=HTMLUtils.generateUniqueId();frameElt.style.position="absolute";frameElt.style.width=frameElt.style.height="50px";frameElt.style.left=frameElt.style.top="-1000px";document.body.appendChild(frameElt);var frame=document.getElementById(frameElt.name);var frameDoc=HTMLUtils.getIFrameDocument(frame);frameDoc.open();frameDoc.write('<html><head><title>SECURED-SIGNIN</title></head><body></body></html>');frameDoc.close();var bodyElt=frameDoc.body;var formElt=frameDoc.createElement("form");formElt.action=IDM.Configuration.getParam("server.url.base.secured")+"/shop/services/session/signin.php";formElt.method="post";formElt.enctype=formElt.encoding="multipart/form-data";formElt.name=formElt.id=HTMLUtils.generateUniqueId();bodyElt.appendChild(formElt);formElt.appendChild(HTMLUtils.createHiddenInput("shop",IDM.Shop.getCurrentShop().getId(),frameDoc));formElt.appendChild(HTMLUtils.createHiddenInput("email",StringUtils.encodeUTF8(email),frameDoc));formElt.appendChild(HTMLUtils.createHiddenInput("password",StringUtils.encodeUTF8(password),frameDoc));var inputElt=frameDoc.createElement("input");inputElt.type="submit";inputElt.name="submitbtn";inputElt.value="submit";formElt.appendChild(inputElt);HTMLUtils.setIFrameOnLoadEvent(frame,function(){parent.IDM.Shop.Session.get()._update();callback()});formElt.submit()}
IDM.Shop.Credit=function(){this.m_id=null;this.m_type=null;this.m_desc=null}
IDM.Shop.Credit.prototype.getId=function(){return this.m_id}
IDM.Shop.Credit.prototype.getType=function(){return this.m_type}
IDM.Shop.Credit.prototype.getDescription=function(){return this.m_desc}
IDM.Shop.Credit.createFromXML=function(dom,node){var credit=new IDM.Shop.Credit();credit.m_id=parseInt(node.getAttribute("id"));credit.m_type=parseInt(node.getAttribute("type"));credit.m_desc=XMLUtils.getChildText(node,"description");return credit}
IDM.Shop.CreditsDialog=Class.define
({ctor:function(){IDM.Shop.CreditsDialog.baseConstructor.call(this);this.setTitle("Remises et cadeaux");this.setButtons([IDM.Dialog.Button.CLOSE])},inherits:IDM.Dialog,prototype:{_constructInner:function(contElt,boxElt){contElt.className+=" sc-credits-dialog";var session=IDM.Shop.Session.get();var custInfos=session.getCustomerInfos();var credits=session.getCredits();if(credits.getCount()==0){var introElt=document.createElement("p");introElt.innerHTML="Bonjour <strong>"+StringUtils.escapeXML(custInfos.showName)+"</strong>, "
+"vous ne disposez d'aucune remise ou cadeau pour le moment.";boxElt.appendChild(introElt)}else
{var introElt=document.createElement("p");introElt.innerHTML="Bonjour <strong>"+StringUtils.escapeXML(custInfos.showName)+"</strong>, "
+"vous disposez des remises et cadeaux suivants :";boxElt.appendChild(introElt);var creditsElt=document.createElement("ul");boxElt.appendChild(creditsElt);for(var i=0,n=credits.getCount();i<n;++i){var credit=credits.getAt(i);var creditElt=document.createElement("li");creditsElt.appendChild(creditElt);creditElt.style.width="400px";var desc=StringUtils.escapeXML(credit.getDescription());desc=StringUtils.replaceString(desc,"[[[","<span>");desc=StringUtils.replaceString(desc,"]]]","</span>");creditElt.innerHTML=desc}
var noticeElt=document.createElement("p");noticeElt.innerHTML="Pour rappel, ces remises sont appliquées <strong>automatiquement</strong>"
+" à votre panier<br/>une fois que vous avez passé commande.";boxElt.appendChild(noticeElt)}}}});IDM.Shop.LoginBox={};IDM.Shop.LoginBox.init=function(){IDM.Shop.LoginBox.update()}
IDM.Shop.LoginBox.update=function(forceSessionUpdate){var session=IDM.Shop.Session.get(forceSessionUpdate);var loginBoxElt=document.getElementById("login");if(!loginBoxElt)
return;var boxTitleElt=HTMLUtils.getChildWithClass(loginBoxElt,"box-title","div");var siLayerElt=HTMLUtils.getChildWithClass(loginBoxElt,"signed-in-layer","div");var nsiLayerElt=HTMLUtils.getChildWithClass(loginBoxElt,"not-signed-in-layer","div");if(!session||!session.isLogon()){HTMLUtils.setElementText(boxTitleElt,"Connexion");HTMLUtils.setElementDisplay(nsiLayerElt,true);HTMLUtils.setElementDisplay(siLayerElt,false)}else
{HTMLUtils.setElementText(boxTitleElt,"Connecté");HTMLUtils.setElementDisplay(siLayerElt,true);HTMLUtils.setElementDisplay(nsiLayerElt,false);var custInfos=session.getCustomerInfos();var authLinks=session.getAuthLinks();var infosElt=HTMLUtils.getChildWithClass(siLayerElt,"user-infos","div");var nameElt=HTMLUtils.getChildWithClass(infosElt,"name","div");var creditsElt=HTMLUtils.getChildWithClass(infosElt,"credits","div");HTMLUtils.setElementText(nameElt,custInfos.showName);var actionsElt=HTMLUtils.getChildWithClass(siLayerElt,"actions","div");var actionsForm=document.createElement("form");var actionHelpElt=HTMLUtils.getChildWithClass(siLayerElt,"action-help-bubble","div");HTMLUtils.removeAllChildren(actionsElt);actionsForm.style.padding="0";actionsForm.style.margin="0";actionsForm.style.position="relative";actionsElt.appendChild(actionsForm);var startElt=document.createElement("span");startElt.className="start";actionsElt.appendChild(startElt);for(var i=0;i<authLinks.length;++i){var authLink=authLinks[i];if(!authLink.visible)
continue;var actionElt=document.createElement("button");actionsForm.appendChild(actionElt);actionElt.className="action "+authLink.id;actionElt.style.cursor="pointer";actionElt.onclick=JSUtils.makeCallback(null,IDM.Shop.LoginBox._onClickedAction,authLink);actionElt.onmouseover=JSUtils.makeCallback(null,IDM.Shop.LoginBox._onMouseOverAction,authLink);actionElt.onmouseout=JSUtils.makeCallback(null,IDM.Shop.LoginBox._onMouseOutAction,authLink);actionElt.onkeypress=JSUtils.IGNORE_EVENT_FUNCTION;actionElt.onkeydown=JSUtils.IGNORE_EVENT_FUNCTION;actionElt.onkeyup=JSUtils.IGNORE_EVENT_FUNCTION}
var endElt=document.createElement("span");endElt.className="end";actionsElt.appendChild(endElt);IDM.Shop.LoginBox.s_infosElt=NodeRef.create(infosElt);IDM.Shop.LoginBox.s_actionHelpElt=NodeRef.create(actionHelpElt)}}
IDM.Shop.LoginBox._onClickedSignIn=function(){var session=IDM.Shop.Session.get();if(session&&session.isLogon())
return false;var dlg=new IDM.Shop.SignInDialog(JSUtils.makeCallback(null,IDM.Shop.LoginBox.update,true));dlg.show();return false}
IDM.Shop.LoginBox._onClickedSignUp=function(){var dlg=new IDM.Shop.SignUpDialog(JSUtils.makeCallback(null,IDM.Shop.LoginBox.update,true));dlg.show();return false}
IDM.Shop.LoginBox._onClickedAction=function(authLink){if(authLink.redirect){HTMLUtils.redirect(document,authLink.url)}else
{var webs=new IDM.WebService(authLink.url);webs.call();var session=IDM.Shop.Session.get(true);if(!session.isLogon())
HTMLUtils.redirect(null,g_shopUrl.toString())}
return false}
IDM.Shop.LoginBox._onMouseOverAction=function(authLink){var actionHelpElt=IDM.Shop.LoginBox.s_actionHelpElt.getElement();HTMLUtils.setElementText(actionHelpElt,authLink.description);HTMLUtils.setElementVisible(actionHelpElt,true);HTMLUtils.setElementVisible(IDM.Shop.LoginBox.s_infosElt.getElement(),false)}
IDM.Shop.LoginBox._onMouseOutAction=function(authLink){HTMLUtils.setElementVisible(IDM.Shop.LoginBox.s_infosElt.getElement(),true);var actionHelpElt=IDM.Shop.LoginBox.s_actionHelpElt.getElement();HTMLUtils.setElementVisible(actionHelpElt,false)}
IDM.Shop.LoginBox.showCredits=function(callback){var dlg=new IDM.Shop.CreditsDialog();dlg.show();if(callback)
dlg.getNamedSlot("button-clicked").attach(callback)}
IDM.Shop.LoginBox.goToSignUp=function(callback){var dlg=new IDM.Shop.SignUpDialog(callback);dlg.show()}
IDM.Shop.LoginBox.addProductToCart=function(productId,modelId,quantity){if(!quantity)
quantity=1;quantity=Math.max(1,parseInt(quantity));var url=new URL("/shop/shop.php");url=url.addParam("sid",IDM.Shop.getCurrentShop().getId());url=url.addParam("op","add-to-cart");url=url.addParam("product",productId);url=url.addParam("model",modelId);url=url.addParam("quantity",quantity);var webs=new IDM.WebService(url);webs.call()}
IDM.Shop.LoginBox.goToProductComposition=function(productId,modelId,params){var url=new URL("/shop/shop.php");url=url.addParam("sid",IDM.Shop.getCurrentShop().getId());url=url.addParam("op","compose");url=url.addParam("product",productId);url=url.addParam("model",modelId);for(p in params)
url=url.addParam(p,params[p]);if(!IDM.Shop.LoginBox.warnIncompatibleBrowser()){if(g_shopConfig["nologin"]){HTMLUtils.redirect(document,url)}else
{IDM.Shop.LoginBox.loginAndRedirect(url)}}}
IDM.Shop.LoginBox.warnIncompatibleBrowser=function(callback){var isCompatible=true;if(JSUtils.getNavigator()==JSUtils.NAVIGATOR_IE&&JSUtils.getNavigatorVersion()<7){isCompatible=false}
if(isCompatible)
return false;var imgId=HTMLUtils.generateUniqueId();var dlg=new IDM.MessageBox();dlg.setTitle("Navigateur incompatible");dlg.setButtons([IDM.Dialog.Button.CLOSE]);dlg.setHTMLText
('<div style="width: 500px">'
+'<p><img id="'+imgId+'" src="/styles/default/images/common/ie6-alert.png" style="float: left; margin: 0 1em 1em 0; width: 100px; height: 86px"/>'
+"<strong>Votre navigateur est trop ancien et techniquement obsolète pour supporter "
+"correctement toutes les technologies employées par notre site.</strong></p>"
+"<p>Il existe aussi tout un choix de navigateurs récents et proposant une multitude de "
+"fonctionnalités très intéressantes. Essayez-les !</p>"
+"<p>Vous pouvez télécharger ou mettre à jour gratuitement sans risque votre navigateur "
+"en cliquant sur un des liens suivants :</p>"
+"<ul>"
+'<li><a href="http://www.mozilla.com/firefox/" target="_blank">Mozilla Firefox</a> (recommandé)</li>'
+'<li><a href="http://www.microsoft.com/ie/" target="_blank">Microsoft Internet Explorer 7 ou 8</a></li>'
+'<li><a href="http://www.apple.com/fr/safari/" target="_blank">Apple Safari</a></li>'
+"</ul>"
+"</div>");dlg.getNamedSlot("show").attach(function(){HTMLUtils.fixPNGImage(document.getElementById(imgId),false,true)});dlg.show();return true}
IDM.Shop.LoginBox.checkAdvertCampaignProductCode=function(code){var url=new URL("/modules/advertising/_services/check-campaign-code.php");url=url.addParam("code",code);var webs=new IDM.WebService(url);return webs.call()&&!webs.isError()}
IDM.Shop.LoginBox.getAdvertCampaignDestination=function(code){var url=new URL("/modules/advertising/_services/go-campaign-code.php");url=url.addParam("code",code);var webs=new IDM.WebService(url);if(webs.call()&&!webs.isError()){var dom=webs.getResult();var node=XMLUtils.getRootElement(dom);var dest=new Object();dest.url=node.getAttribute("url");dest.composeURL=node.getAttribute("compose-url");dest.needLogin=(node.getAttribute("need-login")=="true");return dest}else
{return null}}
IDM.Shop.LoginBox.goToAdvertCampaignProductComposition=function(url){IDM.Shop.LoginBox.loginAndRedirect(url)}
IDM.Shop.LoginBox.loginAndCallback=function(callback){var session=IDM.Shop.Session.get();if(!session||!session.isLogon()){var dlg=new IDM.Shop.LoginRequiredDialog(callback,true);dlg.show()}else
{callback()}}
IDM.Shop.LoginBox.loginAndRedirect=function(url){var session=IDM.Shop.Session.get();if(!session||!session.isLogon()){var dlg=new IDM.Shop.LoginRequiredDialog(JSUtils.makeCallback
(null,IDM.Shop.LoginBox.loginAndRedirectImpl,url),true);dlg.show()}else
{IDM.Shop.LoginBox.loginAndRedirectImpl(url)}}
IDM.Shop.LoginBox.loginAndRedirectImpl=function(url){var waitDlg=new IDM.MessageBox();waitDlg.setTitle("Veuillez patienter");waitDlg.setText("Merci de patienter quelques instants...");waitDlg.setButtons([]);waitDlg.show();JSUtils.invokeLater(JSUtils.makeCallback(null,IDM.Shop.LoginBox.loginAndRedirectImpl2,url))}
IDM.Shop.LoginBox.loginAndRedirectImpl2=function(url){HTMLUtils.redirect(document,url)}
HTMLUtils.addOnLoadFunction(IDM.Shop.LoginBox.init);IDM.Shop.LoginRequiredDialog=Class.define
({ctor:function(callback,showIntro){IDM.Shop.LoginRequiredDialog.baseConstructor.call(this);if(showIntro)
this.setTitle("Inscription nécessaire");else
this.setTitle("");this.setButtons([IDM.Dialog.Button.CANCEL]);this.m_callback=callback;this.m_showIntro=(showIntro?true:false)},inherits:IDM.Dialog,prototype:{_constructInner:function(contElt,boxElt){contElt.className+=" sc-login-dialog";if(this.m_showIntro){var p=document.createElement("p");p.className="intro";p.innerHTML="Pour commander des produits, il est nécessaire de posséder un compte client."
boxElt.appendChild(p)}
var btnContElt=document.createElement("div");btnContElt.className="signbtn-container";boxElt.appendChild(btnContElt);var signinElt=document.createElement("div");signinElt.className="signin";signinElt.onclick=JSUtils.makeCallback(this,IDM.Shop.LoginRequiredDialog.prototype._onClickedSignIn);btnContElt.appendChild(signinElt);HTMLUtils.createMultiTextElement(signinElt,"Déjà inscrit ?",false,"text",2,"div");var signupElt=document.createElement("div");signupElt.className="signup";signupElt.onclick=JSUtils.makeCallback(this,IDM.Shop.LoginRequiredDialog.prototype._onClickedSignUp);btnContElt.appendChild(signupElt);HTMLUtils.createMultiTextElement(signupElt,"Pas encore inscrit ?",false,"text",2,"div")},_onClickedSignIn:function(){this.close();var dlg=new IDM.Shop.SignInDialog(this.m_callback);dlg.show()},_onClickedSignUp:function(){this.close();var dlg=new IDM.Shop.SignUpDialog(this.m_callback);dlg.show()},_onClickedButton:function(btn){return true}}});IDM.Shop.SignInDialog=Class.define
({ctor:function(callback){IDM.Shop.SignInDialog.baseConstructor.call(this);this.setTitle("Connexion");this.setButtons([IDM.Dialog.Button.OK,IDM.Dialog.Button.CANCEL]);this.m_callback=callback;this.m_emailField=null;this.m_passwordField=null},inherits:IDM.Dialog,prototype:{_constructInner:function(contElt,boxElt){var p,input,a;p=document.createElement("p");p.className="email";input=document.createElement("input");input.type="text";input.className="input-control";input.size=35;p.appendChild(HTMLUtils.createLabel(input,"Email : ",false));p.appendChild(input);boxElt.appendChild(p);this.m_emailField=NodeRef.create(input);p=document.createElement("p");p.className="password";input=document.createElement("input");input.type="password";input.className="input-control";input.size=20;p.appendChild(HTMLUtils.createLabel(input,"Mot de passe : ",false));p.appendChild(input);boxElt.appendChild(p);this.m_passwordField=NodeRef.create(input);a=document.createElement("a");a.appendChild(document.createTextNode("Vous avez oublié votre mot de passe ? Cliquez ici."));a.href="#";a.onclick=JSUtils.makeCallback(this,IDM.Shop.SignInDialog.prototype._onClickedForgotPassword);p=document.createElement("p");p.appendChild(a);boxElt.appendChild(p)},_onShow:function(){this.m_emailField.getElement().focus()},_onClickedButton:function(btn){if(btn!=IDM.Dialog.Button.OK)
return true;var email=this.m_emailField.getElement().value;var password=this.m_passwordField.getElement().value;var waitDlg=new IDM.MessageBox();waitDlg.setButtons([]);waitDlg.setTitle("Veuillez patienter");waitDlg.setText("Identification en cours, merci de patienter quelques instants...");var success=IDM.Shop.Session.prototype.signIn(email,password,JSUtils.makeCallback(this,IDM.Shop.SignInDialog.prototype._signInCompleted));if(success===null){this.m_waitDlg=waitDlg;waitDlg.show();return false}else
{this.m_waitDlg=null;return this._signInCompleted(success)}},_signInCompleted:function(success){if(success==window.undefined)
success=IDM.Shop.Session.get().isLogon();var waitDlg=this.m_waitDlg;if(waitDlg)
waitDlg.close();if(success){g_userRegistered=true;g_userName="";IDM.Shop.Session.invalidate();if(this.m_callback)
this.m_callback()}else
{var dlg=new IDM.MessageBox();dlg.setTitle("Mot de passe incorrect");dlg.setHTMLText("<p>L'adresse email ou le mot de passe entré est incorrect.</p>"
+"<p>Veuillez noter que votre mot de passe <strong>distingue les majuscules des minuscules</strong> (vous<br/>"
+"pouvez vérifier que la touche &#171;&#160;Verrouillage majuscule&#160;&#187; de votre clavier n'est pas active).</p>");dlg.show()}
if(waitDlg&&success)
this.close();return success},_onClickedForgotPassword:function(){if(IDM.Shop.Session.get().getPasswordRecoveryType()==IDM.Shop.Session.PASSWORD_RECOVERY_TYPE_REDIRECTION){HTMLUtils.redirect(null,IDM.Shop.Session.get().getPasswordRecoveryURL());return false}
var dlg=new IDM.Shop.SignInForgotPasswordDialog();dlg.show();return false}}});IDM.Shop.SignInForgotPasswordDialog=Class.define
({ctor:function(){IDM.Shop.SignInForgotPasswordDialog.baseConstructor.call(this);this.setTitle("Mot de passe oublié");this.setButtons([IDM.Dialog.Button.OK,IDM.Dialog.Button.CANCEL]);this.m_emailField=null},inherits:IDM.Dialog,prototype:{_constructInner:function(contElt,boxElt){var p,input;p=document.createElement("p");p.innerHTML="Veuillez entrer l'adresse email que vous avez utilisée pour votre inscription.";boxElt.appendChild(p);p=document.createElement("p");input=document.createElement("input");input.type="text";input.className="input-control";input.size=35;p.appendChild(HTMLUtils.createLabel(input,"Email : ",false));p.appendChild(input);boxElt.appendChild(p);this.m_emailField=NodeRef.create(input);p=document.createElement("p");p.innerHTML="Lorsque vous cliquerez sur <strong>OK</strong>, un email sera envoyé à votre adresse pour<br/>vous indiquer la procédure de récupération de votre mot de passe.";boxElt.appendChild(p)},_onShow:function(){this.m_emailField.getElement().focus()},_onClickedButton:function(btn){if(btn!=IDM.Dialog.Button.OK)
return true;var email=this.m_emailField.getElement().value;var webs=new IDM.WebService(new URL("/shop/services/session/signin-password.php").addParam("sid",IDM.Shop.getCurrentShop().getId()).addParam("email",StringUtils.encodeUTF8(email)));webs.call();if(webs.isSuccess()){var dlg=new IDM.MessageBox();dlg.setTitle("Email envoyé");dlg.setHTMLText("Un email avec la procédure pour récupérer un mot de passe vous a été envoyé.<br/>Vous le recevrez d'ici à quelques minutes.");dlg.show();return true}else
{if(JSUtils.isDebug())
alert(webs.getError());var dlg=new IDM.MessageBox();dlg.setTitle("Email incorrect");dlg.setText("L'adresse email entrée ne correspond à aucun compte client.");dlg.show();return false}}}});IDM.Shop.SignUpDialog=Class.define
({ctor:function(callback,partnerId){IDM.Shop.SignUpDialog.baseConstructor.call(this);this.setTitle("Inscription");this.setButtons([IDM.Dialog.Button.OK,IDM.Dialog.Button.CANCEL]);this.m_callback=callback;this.m_genderField=null;this.m_yobField=null;this.m_firstNameField=null;this.m_lastNameField=null;this.m_emailField=null;this.m_passwordField=null;this.m_password2Field=null;this.m_mailingField=null;this.m_thirdPartyField=null;this.m_sponsorField=null;this.m_partnerId=null;this.m_emailIsValid=[]},inherits:IDM.Dialog,prototype:{_constructInner:function(contElt,boxElt){contElt.className+=" sc-signup-dialog";var input,label,span;var formData=[];var p=document.createElement("p");p.className="intro";p.innerHTML="Pour commander des produits, il est nécessaire de créer un compte client.<br/>"
+"C'est totalement gratuit et ne vous demande que quelques secondes.";boxElt.appendChild(p);input=HTMLUtils.createSelectElement();label=HTMLUtils.createLabel(input,"Civilité : ",false);input.options[0]=new Option("Monsieur",1);input.options[1]=new Option("Madame",2);input.options[2]=new Option("Mademoiselle",3);this.m_genderField=NodeRef.create(input);formData[formData.length]=[label,input];input=document.createElement("input");input.type="text";input.className="input-control";input.size=30;input.maxLength=40;label=HTMLUtils.createLabel(input,"Prénom : ",false);formData[formData.length]=[label,input];this.m_firstNameField=NodeRef.create(input);input=document.createElement("input");input.type="text";input.className="input-control";input.size=30;input.maxLength=40;label=HTMLUtils.createLabel(input,"Nom : ",false);formData[formData.length]=[label,input];this.m_lastNameField=NodeRef.create(input);input=document.createElement("input");input.type="text";input.className="input-control";input.size=45;input.maxLength=80;input.onblur=JSUtils.makeCallback(this,IDM.Shop.SignUpDialog.prototype._onBlurEmailField);input.onkeyup=JSUtils.makeCallback(this,IDM.Shop.SignUpDialog.prototype._onChangeEmailField);label=HTMLUtils.createLabel(input,"Email : ",false);formData[formData.length]=[label,input];this.m_emailField=NodeRef.create(input);var yobInput=HTMLUtils.createSelectElement();yobInput.options[0]=new Option("(choisissez)",0)
for(var i=DateTime.now().getYear()-10,j=1;i>=1900;--i,++j)
yobInput.options[j]=new Option(""+i,i);var yobSpan=document.createElement("div");yobSpan.appendChild(HTMLUtils.createLabel(yobInput,"Année de naissance : ",false));yobSpan.appendChild(document.createElement("br"));yobSpan.appendChild(yobInput);yobSpan.style.position="absolute";yobSpan.style.top="0px";yobSpan.style.left="65%";this.m_yobField=NodeRef.create(yobInput);var frameElt=HTMLUtils.createFieldSet("Informations personnelles");boxElt.appendChild(frameElt);var formElt=HTMLUtils.createTable(formData,true);frameElt.style.position="relative";frameElt.appendChild(yobSpan);frameElt.appendChild(formElt);formData=[];input=document.createElement("input");input.type="password";input.className="input-control";input.size=20;label=HTMLUtils.createLabel(input,"Mot de passe : ",false);var span=document.createElement("span");span.appendChild(input);formData[formData.length]=[label,span];this.m_passwordField=NodeRef.create(input);input=document.createElement("input");input.type="password";input.className="input-control";input.size=20;label=HTMLUtils.createLabel(input,"Confirmer : ",false);var span=document.createElement("span");span.appendChild(input);formData[formData.length]=[label,span];this.m_password2Field=NodeRef.create(input);frameElt=HTMLUtils.createFieldSet("Mot de passe");boxElt.appendChild(frameElt);span=document.createElement("span");span.style.cssFloat="left";span.style.paddingRight="2em";span.style.paddingTop="0.8em";span.innerHTML="Choisissez un mot de passe<br/>de <strong>5 caractères minimum</strong>.";formElt=HTMLUtils.createTable(formData,true);frameElt.appendChild(span);frameElt.appendChild(formElt);if(g_shopConfig["sponsoring"]){var inputElt=document.createElement("input");inputElt.type="text";inputElt.className="input-control";inputElt.size=40;this.m_sponsorField=NodeRef.create(inputElt);var frameElt=HTMLUtils.createFieldSet("Parrainage");frameElt.className="sponsoring";boxElt.appendChild(frameElt);var p=document.createElement("p");p.className="text";p.innerHTML="Vous nous avez connu par l'intermédiaire d'une personne déjà cliente ?<br/>Entrez son adresse email pour bénéficier, vous et lui, de cadeaux !";frameElt.appendChild(p);p=document.createElement("p");p.appendChild(HTMLUtils.createLabel(inputElt,"Email du parrain : "));p.appendChild(inputElt);frameElt.appendChild(p)}
if(!g_autoSuscribeMailing){var p=document.createElement("p");var checkbox=document.createElement("input");checkbox.type="checkbox";checkbox.checked=checkbox.defaultChecked=true;p.appendChild(checkbox);p.appendChild(document.createTextNode("\u00A0"));var msg=(g_shopMessage['signup.mailing']?g_shopMessage['signup.mailing']:"J'accepte de recevoir des informations concernant cette boutique");p.appendChild(HTMLUtils.createLabel(checkbox,StringUtils.replaceString(StringUtils.escapeXML(msg),"\n","<br/>"),true));boxElt.appendChild(p);this.m_mailingField=NodeRef.create(checkbox)}
if(g_enableThirdPartyOptIn){var p=document.createElement("p");var checkbox=document.createElement("input");checkbox.type="checkbox";checkbox.checked=checkbox.defaultChecked=true;p.appendChild(checkbox);p.appendChild(document.createTextNode("\u00A0"));var msg=(g_shopMessage['signup.3rd-party']?g_shopMessage['signup.3rd-party']:"J'accepte d'être inscrit(e) sur d'autres sites partenaires");p.appendChild(HTMLUtils.createLabel(checkbox,StringUtils.replaceString(StringUtils.escapeXML(msg),"\n","<br/>"),true));boxElt.appendChild(p);this.m_thirdPartyField=NodeRef.create(checkbox)}
var noticeElt=document.createElement("p");noticeElt.className="notice";noticeElt.style.fontSize="90%";noticeElt.style.lineHeight="100%";noticeElt.style.textAlign="justify";noticeElt.style.fontWeight="normal";noticeElt.innerHTML="Ces informations sont détenues par notre société car elles sont nécessaires à l'exécution<br/>de la prestation. Conformément à la loi du 6 janvier 1978, vous disposez d'un droit d'accès,<br/>de rectification et d'opposition aux données vous concernant, qui peut s'exercer<br/>à tout moment à partir de la page &quot;Contact&quot; du site.";boxElt.appendChild(noticeElt)},_onShow:function(){this.m_firstNameField.getElement().focus()},_onClickedButton:function(btn){if(btn!=IDM.Dialog.Button.OK)
return true;var gender=parseInt(this.m_genderField.getElement().value);var yob=parseInt(this.m_yobField.getElement().value);var firstName=StringUtils.trim(this.m_firstNameField.getElement().value);var lastName=StringUtils.trim(this.m_lastNameField.getElement().value);var email=StringUtils.trim(this.m_emailField.getElement().value);var password=StringUtils.trim(this.m_passwordField.getElement().value);var password2=StringUtils.trim(this.m_password2Field.getElement().value);var mailing=g_autoSuscribeMailing?true:this.m_mailingField.getElement().checked;var thirdPartyOptin=(g_enableThirdPartyOptIn?this.m_thirdPartyField.getElement().checked:false);var sponsor=(this.m_sponsorField?StringUtils.trim(this.m_sponsorField.getElement().value):"");var errors=new ArrayList();if(firstName.length==0)
errors.add("Vous devez entrer votre nom.");if(lastName.length==0)
errors.add("Vous devez entrer votre prénom.");if(email.length==0)
errors.add("Vous devez entrer votre adresse email.");if(password.length==0)
errors.add("Vous devez entrer un mot de passe.");else if(password.length<5)
errors.add("Le mot de passe doit contenir au moins 5 caractères.");else if(password2!=password)
errors.add("Le mot de passe et la confirmation ne correspondent pas.");if(errors.isEmpty()){var signupDialog=this;var signupFunction=function(forceInvalidEmail){var websURL=new URL("/shop/services/session/signup.php").addParam("shop",IDM.Shop.getCurrentShop().getId()).addParam("gender",gender).addParam("year-of-birth",yob).addParam("first-name",StringUtils.encodeUTF8(firstName)).addParam("last-name",StringUtils.encodeUTF8(lastName)).addParam("email",StringUtils.encodeUTF8(email)).addParam("acceptemail",forceInvalidEmail?1:0).addParam("password",StringUtils.encodeUTF8(password)).addParam("mailing",mailing?1:0).addParam("thirdpartyoptin",thirdPartyOptin?1:0);if(this.m_partnerId!=null)
websURL=websURL.addParam("partner",this.m_partnerId);if(g_shopConfig["sponsoring"])
websURL=websURL.addParam("sponsor",sponsor);var webs=new IDM.WebService(websURL);webs.call();if(webs.isSuccess()){var res=webs.getResult();var rootElt=XMLUtils.getRootElement(res);g_userRegistered=true;g_userName=rootElt.getAttribute("name");g_userId=parseInt(rootElt.getAttribute("id"));IDM.Shop.Session.invalidate();var trackers="";for(var i=0,n=g_trackers.getCount();i<n;++i){var tr=g_trackers.getAt(i);if(tr.getType()==IDM.Shop.Tracker.TYPE_REGISTRATION){var url=tr.getTriggerURL(IDM.Shop.getCurrentShop().getId(),g_userId,email,firstName,lastName);trackers+="<img src=\""+StringUtils.escapeXML(url)+"\" width=\"0\" height=\"0\"/>"}}
var callback=signupDialog.m_callback;var dlg=new IDM.MessageBox();dlg.setTitle("Félicitations !");dlg.setText("Cher client, votre inscription a été validée.\n\n"
+"Vous allez recevoir d'ici à quelques minutes un message\nde confirmation"
+" sur votre adresse email.\n\nMerci pour votre confiance !");dlg.setAppendHTML(trackers);dlg.setOnClickedButtonCallback
(function(dlg,result){if(callback)
callback();return true});dlg.show();signupDialog.close()}else
{var error=webs.getError();if(JSUtils.isDebug())
alert(error);if(error.getCode()==IDM.WebService.Error.Code.ALREADY_EXISTS){var dlg=new IDM.MessageBox();dlg.setTitle("Erreur");dlg.setText("Un compte est déjà inscrit avec cette adresse email !");dlg.show()}else if(error.getCode()==IDM.WebService.Error.Code.ARGUMENT_REJECTED){var dlg=new IDM.MessageBox();dlg.setTitle("Erreur");dlg.setText("Cette adresse email n'est pas autorisée pour l'inscription.\nVeuillez utiliser une autre adresse.");dlg.show()}else if(error.getCode()==IDM.WebService.Error.Code.NOT_FOUND&&StringUtils.contains(error.getMessage(),"sponsor")){var dlg=new IDM.MessageBox();dlg.setTitle("Erreur");dlg.setText("Veuillez vérifier l'email du parrain, nous n'avons trouvé\naucun client enregistré avec cette adresse.");dlg.show()}else
{var dlg=new IDM.MessageBox();dlg.setTitle("Erreur");dlg.setText("Une erreur inattendue est survenue, nous vous prions de nous\n"
+"excuser pour le désagrément.\n\nVeuillez réessayer dans quelques minutes...");dlg.show()}}};if(email.indexOf("@")==-1||email.length<5){var dlg=new IDM.MessageBox();dlg.setButtons([IDM.Dialog.Button.OK]);dlg.setTitle("Problème avec votre email");dlg.setHTMLText("<p>L'adresse email que vous avez entrée n'est pas valide !</p>"
+"<p>Une adresse email est de la forme : <strong>prenom.nom@fournisseur.fr</strong>.</p>");dlg.show()}else if(!this._isEmailValid(email)){var dlg=new IDM.MessageBox();var noButton=new IDM.Dialog.Button("Non, je vais corriger",IDM.Dialog.Button.NO.getId(),IDM.Dialog.Button.FLAG_CANCEL);dlg.setButtons([IDM.Dialog.Button.YES,noButton]);dlg.setTitle("Problème avec votre email");dlg.setHTMLText("<p>L'adresse email que vous avez entrée ne semble pas valide !</p>"
+"<p style=\"text-align: center\">"+StringUtils.escapeXML(email)+"</p>"
+"<p>Ne manque-t-il pas une lettre ? Vérifiez l'orthographe...<br/>"
+"N'avez vous pas confondu .FR et .COM ?</p>"
+"<p><strong>Pourquoi est-ce important de donner un email valide ?</strong></p>"
+"<p>Nous avons besoin d'un email sur lequel vous contacter pour le suivi"
+" de vos commandes,<br/>ou pour répondre aux questions que vous pourriez"
+" nous poser.</p>"
+"<p style=\"padding-top: 1.5em; margin-bottom: 0px; text-align: center\">"
+"Voulez-vous tout de même continuer avec cette adresse email ?</p>");dlg.setOnClickedButtonCallback
(function(dlg,result){if(result.getButton()==IDM.Dialog.Button.YES)
signupFunction(true);return true});dlg.show()}else
{signupFunction(false)}
return false}else
{var dlg=new IDM.MessageBox();dlg.setTitle("Erreur");if(errors.getCount()==1){dlg.setText(errors.getAt(0))}else
{var text="<p>Cher client, nous avons détecté des problèmes dans les éléments que vous avez saisis :</p>";text+="<ul>";for(var i=0,n=errors.getCount();i<n;++i)
text+="<li>"+StringUtils.escapeXML(errors.getAt(i))+"</li>";text+="</ul>";dlg.setHTMLText(text)}
dlg.show();return false}},_isEmailValid:function(email){if(this.m_emailIsValid[email]===true)
return true;else if(this.m_emailIsValid[email]===false)
return false;var http=new HTTPRequest("/services/misc/verifyemail.php?email="+URL.escape(email)+"&full-check=1");var response=http.sendSync();this.m_emailIsValid[email]=(response=="OK");return this.m_emailIsValid[email]},_onChangeEmailField:function(){if(this.m_verifyEmailTimeout){clearTimeout(this.m_verifyEmailTimeout);this.m_verifyEmailTimeout=null}
this.m_verifyEmailTimeout=setTimeout
(JSUtils.makeCallback(this,IDM.Shop.SignUpDialog.prototype._onBlurEmailField),700)},_onBlurEmailField:function(){var email=StringUtils.trim(this.m_emailField.getElement().value);this._verifyEmail(email)},_verifyEmail:function(email){email=StringUtils.trim(email);if(email.length==0)
return;if(this.m_emailIsValid[email]===true||this.m_emailIsValid[email]===false)
return;JSUtils.invokeLater(JSUtils.makeCallback(this,IDM.Shop.SignUpDialog.prototype._verifyEmail2,email))},_verifyEmail2:function(email){var http=new HTTPRequest("/services/misc/verifyemail.php?email="+URL.escape(email)+"&full-check=1");var response=http.sendSync();this.m_emailIsValid[email]=(response=="OK")}}});if(window.SC==window.undefined)SC={};SC.Session=IDM.Shop.Session;SC.Credit=IDM.Shop.Credit;SC.CreditsDialog=IDM.Shop.CreditsDialog;SC.Shop=IDM.Shop;SC.LoginBox=IDM.Shop.LoginBox;SC.AsynchronousLoader=IDM.AsynchronousLoader;SC.LoginRequiredDialog=IDM.Shop.LoginRequiredDialog;SC.SignInDialog=IDM.Shop.SignInDialog;SC.SignUpDialog=IDM.Shop.SignUpDialog;IDM.Text=Class.define
({ctor:function(data,attribs){this.m_data=(data?JSUtils.toString(data):"");this.m_attribs=(attribs?attribs:new IDM.TextAttributes())},static:{createFromXML:function(node){var txt=new IDM.Text();if(!txt.readFromXML(node))
return null;return txt}},prototype:{getData:function(){return this.m_data},setData:function(data){this.m_data=JSUtils.toString(data)},getAttributes:function(){return this.m_attribs},setAttributes:function(attribs){this.m_attribs=attribs},isEmpty:function(){return this.m_data.length==0},readFromXML:function(node){this.m_data=XMLUtils.getChildTextSafe(node,"data");var attribsNode=XMLUtils.getChildByTagName(node,"text-attributes");this.m_attribs=(attribsNode!=null?IDM.TextAttributes.createFromXML(attribsNode):new IDM.TextAttributes());return true},writeToXML:function(dom){var node=dom.createElement("text");XMLUtils.setChildText(dom,node,"data",this.m_data);node.appendChild(this.m_attribs.writeToXML(dom));return node},clone:function(){var txt=new IDM.Text();txt.m_data=this.m_data;txt.m_attribs=this.m_attribs.clone();return txt},toURLParam:function(){var data=StringUtils.encodeBase64(StringUtils.encodeUTF8(this.m_data));return data.length+"|"+data+"|"+this.m_attribs.toURLParam()}}});IDM.TextAttributes=Class.define
({ctor:function(){this.m_font=IDM.Font.getDefault();this.m_size=0;this.m_color=new Color(0,0,0);this.m_backColor=null;this.m_align=IDM.Alignment.MIDDLE_CENTER;this.m_interline=100;this.m_interletter=0},static:{UNDEFINED_VALUE:window.undefined,createFromXML:function(node){var ta=new IDM.TextAttributes();if(!ta.readFromXML(node))
return null;return ta}},prototype:{getFont:function(){return this.m_font},setFont:function(font){this.m_font=font},getSize:function(){return this.m_size},setSize:function(size){this.m_size=size},getColor:function(){return this.m_color},setColor:function(color){this.m_color=color},getBackColor:function(){return this.m_backColor},setBackColor:function(color){this.m_backColor=color},getAlignment:function(){return this.m_align},setAlignment:function(align){this.m_align=align},getInterline:function(){return this.m_interline},setInterline:function(interline){this.m_interline=interline},getInterletter:function(){return this.m_interletter},setInterletter:function(interletter){this.m_interletter=interletter},readFromXML:function(node){var font=XMLUtils.getChildText(node,"font");this.m_font=(font!=null?IDM.Font.fromString(font):IDM.Font.getDefault());var size=XMLUtils.getChildText(node,"size");this.m_size=(size!=null?NumberUtils.parseNumberSafe(size,0):0);var color=XMLUtils.getChildText(node,"color");this.m_color=(color!=null?Color.fromHex(color):new Color(0,0,0));var backColor=XMLUtils.getChildText(node,"backcolor");this.m_backColor=(backColor!=null?Color.fromHex(backColor):null);var align=XMLUtils.getChildText(node,"align");this.m_align=(align!=null?parseInt(align):IDM.Alignment.MIDDLE_CENTER);var interline=XMLUtils.getChildText(node,"interline");this.m_interline=(interline!=null?NumberUtils.parseNumberSafe(interline,100):100);var interletter=XMLUtils.getChildText(node,"interletter");this.m_interletter=(interletter!=null?NumberUtils.parseNumberSafe(interletter,0):0);return true},writeToXML:function(dom){var node=dom.createElement("text-attributes");if(this.m_font!==IDM.TextAttributes.UNDEFINED_VALUE)
XMLUtils.setChildText(dom,node,"font",this.m_font.toString());if(this.m_size!==IDM.TextAttributes.UNDEFINED_VALUE)
XMLUtils.setChildText(dom,node,"size",NumberUtils.formatFloat(this.m_size));if(this.m_color!==IDM.TextAttributes.UNDEFINED_VALUE)
XMLUtils.setChildText(dom,node,"color",this.m_color.toHex());if(this.m_backColor!==IDM.TextAttributes.UNDEFINED_VALUE&&this.m_backColor!=null)
XMLUtils.setChildText(dom,node,"backcolor",this.m_backColor.toHex());if(this.m_align!==IDM.TextAttributes.UNDEFINED_VALUE)
XMLUtils.setChildText(dom,node,"align",this.m_align);if(this.m_interline!==IDM.TextAttributes.UNDEFINED_VALUE)
XMLUtils.setChildText(dom,node,"interline",NumberUtils.formatFloat(this.m_interline));if(this.m_interletter!==IDM.TextAttributes.UNDEFINED_VALUE)
XMLUtils.setChildText(dom,node,"interletter",NumberUtils.formatFloat(this.m_interletter));return node},copyToWithMerging:function(ta){if(this.m_font!==IDM.TextAttributes.UNDEFINED_VALUE)
ta.m_font=this.m_font;if(this.m_size!==IDM.TextAttributes.UNDEFINED_VALUE)
ta.m_size=this.m_size;if(this.m_color!==IDM.TextAttributes.UNDEFINED_VALUE)
ta.m_color=this.m_color;if(this.m_backColor!==IDM.TextAttributes.UNDEFINED_VALUE)
ta.m_backColor=this.m_backColor;if(this.m_align!==IDM.TextAttributes.UNDEFINED_VALUE)
ta.m_align=this.m_align;if(this.m_interline!==IDM.TextAttributes.UNDEFINED_VALUE)
ta.m_interline=this.m_interline;if(this.m_interletter!==IDM.TextAttributes.UNDEFINED_VALUE)
ta.m_interletter=this.m_interletter},clone:function(){var ta=new IDM.TextAttributes();ta.m_font=this.m_font;ta.m_size=this.m_size;ta.m_color=this.m_color;ta.m_backColor=this.m_backColor;ta.m_align=this.m_align;ta.m_interline=this.m_interline;ta.m_interletter=this.m_interletter;return ta},toURLParam:function(){var data=[this.m_font.toString(),NumberUtils.formatFloat(this.m_size),this.m_color.toHex(),(this.m_backColor==null?"":this.m_backColor.toHex()),this.m_align,NumberUtils.formatFloat(this.m_interline),NumberUtils.formatFloat(this.m_interletter)];return StringUtils.implode("|",data)}}});IDM.Design={};IDM.Design.ManageAttachmentsDialog=Class.define
({ctor:function(moduleTag){IDM.Design.ManageAttachmentsDialog.baseConstructor.call(this);this.setTitle("Gestion des objets attachés");this.setButtons([IDM.Dialog.Button.OK,IDM.Dialog.Button.CANCEL]);this.m_moduleTag=moduleTag;this.m_attachs=new ArrayList();this.m_listElt=null},inherits:IDM.Dialog,prototype:{_constructInner:function(contElt,boxElt){var listElt=document.createElement("div");listElt.className="list-control";listElt.style.width="30em";listElt.style.height="20em";listElt.style.cssFloat="left";boxElt.appendChild(listElt);this.m_listElt=NodeRef.create(listElt);var btnContElt=document.createElement("div");btnContElt.style.cssFloat="left";btnContElt.style.marginLeft="1em";boxElt.appendChild(btnContElt);var deleteBtnElt=HTMLUtils.createButton("Supprimer");deleteBtnElt.style.width="100%";deleteBtnElt.onclick=JSUtils.makeCallback(this,IDM.Design.ManageAttachmentsDialog.prototype._onClickedDelete);var uploadBtnElt=HTMLUtils.createButton("Ajouter...");uploadBtnElt.style.width="100%";uploadBtnElt.onclick=JSUtils.makeCallback(this,IDM.Design.ManageAttachmentsDialog.prototype._onClickedUpload);btnContElt.appendChild(uploadBtnElt);btnContElt.appendChild(document.createElement("br"));btnContElt.appendChild(document.createElement("br"));btnContElt.appendChild(deleteBtnElt)},_onShow:function(){this._reload()},_update:function(){var listElt=this.m_listElt.getElement();HTMLUtils.removeAllChildren(listElt);for(var i=0,n=this.m_attachs.getCount();i<n;++i){var att=this.m_attachs.getAt(i);var itemElt=document.createElement("div");listElt.appendChild(itemElt);itemElt.style.lineHeight="2em";itemElt.m_att=att;var checkElts=HTMLUtils.createCheckboxWithLabel(att.filename);itemElt.appendChild(checkElts[0]);att.checkBoxElt=NodeRef.create(checkElts[1]);att.itemElt=NodeRef.create(itemElt)}},_reload:function(){var webs=new IDM.WebService(new URL("/modules/utils/attachment/_services/enum-attachments.php").addParam("module",this.m_moduleTag));this.m_attachs=new ArrayList();if(webs.call()&&webs.isSuccess()){var dom=webs.getResult();var attsNode=XMLUtils.getRootElement(dom);var attNodes=XMLUtils.getChildrenByTagName(attsNode,"attachment");for(var i=0,n=attNodes.length;i<n;++i){var attNode=attNodes[i];var fileid=attNode.getAttribute("fileid");var filename=attNode.getAttribute("filename");var att={};att.fileid=fileid;att.filename=filename;this.m_attachs.add(att)}}
this._update();FontChooserEx.invalidateCache()},_onClickedDelete:function(){if(!confirm("Supprimer les fichiers sélectionnés ?"))
return;var needUpdate=false;for(var n=this.m_attachs.getCount(),i=n-1;i>=0;--i){var att=this.m_attachs.getAt(i);if(att.checkBoxElt.getElement().checked){var webs=new IDM.WebService(new URL("/modules/utils/attachment/_services/delete-attachment.php").addParam("module",this.m_moduleTag).addParam("fileid",att.fileid));if(webs.call()&&webs.isSuccess()){this.m_attachs.removeAt(i);needUpdate=true}}}
if(needUpdate)
this._update()},_onClickedUpload:function(){var dlg=new IDM.Design.ManageAttachmentsDialog.UploadDialog(this.m_moduleTag);dlg.show();dlg.getNamedSlot("button-clicked").attach
(JSUtils.makeCallback(this,IDM.Design.ManageAttachmentsDialog.prototype._reload))}}});IDM.Design.ManageAttachmentsDialog.UploadDialog=Class.define
({ctor:function(moduleTag){IDM.Design.ManageAttachmentsDialog.UploadDialog.baseConstructor.call(this);this.setTitle("Ajout d'un fichier");this.setButtons([IDM.Dialog.Button.OK,IDM.Dialog.Button.CANCEL]);this.m_moduleTag=moduleTag;this.m_file=null;this.m_fontFile=null;this.m_fontFileB=null;this.m_fontFileI=null;this.m_fontFileBI=null},inherits:IDM.Dialog,prototype:{_constructInner:function(contElt,boxElt){var fileFrameElt=HTMLUtils.createFieldSet("Fichier");boxElt.appendChild(fileFrameElt);this.m_file=new IDM.Design.ManageAttachmentsDialog.UploadDialog.UploadField();fileFrameElt.appendChild(this.m_file.getHTMLElement());var fontFrameElt=HTMLUtils.createFieldSet("Police");boxElt.appendChild(fontFrameElt);this.m_fontFile=new IDM.Design.ManageAttachmentsDialog.UploadDialog.UploadField();this.m_fontFileB=new IDM.Design.ManageAttachmentsDialog.UploadDialog.UploadField();this.m_fontFileI=new IDM.Design.ManageAttachmentsDialog.UploadDialog.UploadField();this.m_fontFileBI=new IDM.Design.ManageAttachmentsDialog.UploadDialog.UploadField();var p=document.createElement("p");p.appendChild(document.createTextNode("Normal : "));p.appendChild(this.m_fontFile.getHTMLElement());fontFrameElt.appendChild(p);p=document.createElement("p");p.appendChild(document.createTextNode("Gras : "));p.appendChild(this.m_fontFileB.getHTMLElement());fontFrameElt.appendChild(p);p=document.createElement("p");p.appendChild(document.createTextNode("Italique : "));p.appendChild(this.m_fontFileI.getHTMLElement());fontFrameElt.appendChild(p);p=document.createElement("p");p.appendChild(document.createTextNode("Gras + Italique : "));p.appendChild(this.m_fontFileBI.getHTMLElement());fontFrameElt.appendChild(p)},_onClickedButton:function(btn){if(btn!=IDM.Dialog.Button.OK)
return true;if(this.m_file.getFileId()==null&&this.m_fontFile.getFileId()==null){alert("Vous devez sélectionner un fichier à ajouter.");return false}
var websURL=null;if(this.m_fontFile.getFileId()!=null){websURL=new URL("/modules/utils/attachment/_services/add-font-attachment.php").addParam("module",this.m_moduleTag).addParam("file",this.m_fontFile.getFileId());if(this.m_fontFileB.getFileId()!=null)
websURL=websURL.addParam("fileb",this.m_fontFileB.getFileId());if(this.m_fontFileI.getFileId()!=null)
websURL=websURL.addParam("filei",this.m_fontFileI.getFileId());if(this.m_fontFileBI.getFileId()!=null)
websURL=websURL.addParam("filebi",this.m_fontFileBI.getFileId())}else
{websURL=new URL("/modules/utils/attachment/_services/add-attachment.php").addParam("module",this.m_moduleTag).addParam("filename",this.m_file.getFileName()).addParam("file",this.m_file.getFileId())}
var webs=new IDM.WebService(websURL);webs.call();if(!webs.isSuccess()){alert("Erreur lors de l'ajout du fichier.");return false}
return true}}});IDM.Design.ManageAttachmentsDialog.UploadDialog.UploadField=Class.define
({ctor:function(){IDM.Design.ManageAttachmentsDialog.UploadDialog.UploadField.baseConstructor.call(this);this.m_fileid=null;this.m_filename=null},inherits:IDM.Component,prototype:{getFileId:function(){return this.m_fileid},getFileName:function(){return this.m_filename},_create:function(contElt){var nameElt=document.createElement("span");nameElt.className="input-control";nameElt.style.width="11em";nameElt.style.overflow="hidden";nameElt.style.textOverflow="ellipsis";HTMLUtils.setElementInlineBlock(nameElt);HTMLUtils.setElementText(nameElt,"(aucun fichier)");var btnElt=HTMLUtils.createButton("...");btnElt.onclick=JSUtils.makeCallback(this,IDM.Design.ManageAttachmentsDialog.UploadDialog.UploadField.prototype._onClickedButton);contElt.appendChild(nameElt);contElt.appendChild(document.createTextNode(" "));contElt.appendChild(btnElt);this.m_nameElt=NodeRef.create(nameElt)},_onClickedButton:function(){var dlg=new IDM.Design.ManageAttachmentsDialog.UploadFileDialog();dlg.show();dlg.getNamedSlot("button-clicked").attach(JSUtils.makeCallback(this,IDM.Design.ManageAttachmentsDialog.UploadDialog.UploadField.prototype._onUploadDialogClosed))},_onUploadDialogClosed:function(slot,res){var dlg=slot.getObject();if(dlg.getFileId()!=null){this.m_fileid=dlg.getFileId();this.m_filename=dlg.getFileName();HTMLUtils.setElementText(this.m_nameElt.getElement(),this.m_filename)}}}});IDM.Design.ManageAttachmentsDialog.UploadFileDialog=Class.define
({ctor:function(){IDM.Design.ManageAttachmentsDialog.UploadFileDialog.baseConstructor.call(this);this.setTitle("Envoi d'un fichier");this.setButtons([IDM.Dialog.Button.CANCEL]);this.m_iframeElt=null;this.m_formElt=null;this.m_fileid=null;this.m_filename=null},inherits:IDM.Dialog,prototype:{getFileId:function(){return this.m_fileid},getFileName:function(){return this.m_filename},_constructInner:function(contElt,boxElt){var frameElt=document.createElement("iframe");boxElt.appendChild(frameElt);frameElt.style.width="30em";frameElt.style.height="10em";frameElt.style.borderWidth="0px";var frameDoc=HTMLUtils.getIFrameDocument(frameElt);frameDoc.open();frameDoc.write('<html><head><title>UPLOAD</title></head><body style="margin: 0px; padding: 0px"></body></html>');frameDoc.close();var bodyElt=frameDoc.body;var formElt=frameDoc.createElement("form");formElt.action="/modules/upload/services/upload-file.php";formElt.method="post";formElt.enctype=formElt.encoding="multipart/form-data";formElt.name=formElt.id=HTMLUtils.generateUniqueId();formElt.style.margin="0px";formElt.style.padding="0px";bodyElt.appendChild(formElt);var inputElt=frameDoc.createElement("input");inputElt.type="file";inputElt.name="file";inputElt.id=HTMLUtils.generateUniqueId();var p=document.createElement("p");p.appendChild(inputElt);formElt.appendChild(p);var submitElt=frameDoc.createElement("input");submitElt.type="submit";submitElt.value="Envoyer";submitElt.onclick=JSUtils.makeCallback(this,IDM.Design.ManageAttachmentsDialog.UploadFileDialog.prototype._onClickedSubmit);p=document.createElement("p");p.appendChild(submitElt);formElt.appendChild(p);this.m_iframeElt=NodeRef.create(frameElt);this.m_formElt=NodeRef.create(formElt)},_onClickedSubmit:function(){var frameElt=this.m_iframeElt.getElement();HTMLUtils.setIFrameOnLoadEvent(frameElt,JSUtils.makeCallback(this,IDM.Design.ManageAttachmentsDialog.UploadFileDialog.prototype._onFileUploaded))},_onFileUploaded:function(){var frameElt=this.m_iframeElt.getElement();var frameDoc=HTMLUtils.getIFrameDocument(frameElt);var rootElt=XMLUtils.getRootElement(frameDoc);if(rootElt.tagName=="file"){this.m_fileid=rootElt.getAttribute("id");this.m_filename=rootElt.getAttribute("name")}
var this_=this;JSUtils.invokeLater(function(){this_._clickButton(IDM.Dialog.Button.CANCEL)})}}});function IDM_fixTabInTextAreas(){var elts=document.getElementsByTagName("textarea");for(var i=0,n=elts.length;i<n;++i)
HTMLUtils.allowTabInTextArea(elts[i])}
HTMLUtils.addOnLoadFunction(IDM_fixTabInTextAreas);
