PageSourceSearch

https://123spandoek.nl/js/v3element.js?v=2.11&nocache=1791418781

js 123spandoek.nl collected 2026-10-08 00:20:42 UTC 219,844 bytes, 4,778 lines download raw bytes

1function v3element() {
2     var objElement=this;
3     var thisElement=this;
4     this.elementtype=2;
5     this.width=0;
6     this.height=0;
7     this.left=0;
8     this.top=0;
9     this.rotation=0;
10     this.bgtop=0;
11     this.bgleft=0;
12     this.color="";
13     this.colorname="";
14     this.text="";
15     this.alignment=0;
16     this.font="";
17     this.fontid=0;
18     this.fontdisplayname="";
19     this.fontminimum=0;
20     this.foliefactor=1;
21     this.minwidth=0;
22     this.minheight=0;
23     this.bold=0;
24     this.italic=0;
25     this.letterheight=0;
26     this.elementid=0;
27     this.textid=0;
28     this.useOutline=0;
29     this.outlinecolor=""
30     this.origOutlinecolor="";
31     this.origOutlinecolorname="";
32     this.timerVar=0;
33     this.timerID;
34     this.hwRatio;
35     this.hwRatioOriginal;
36     this.tlRatio;
37     this.zindex=10
38     this.lockRatio=1;
39     this.propdiv;
40     this.visibleElement;
41     this.visibleElementPic;
42     this.breedte;
43     this.hoogte;
44     this.x;
45     this.y;
46     this.libraryID=0;
47     this.image;
48     this.uploadID=0;
49     this.filesource="";
50     this.hasColor=0;
51     this.protocol="http://";
52     this.qualitylevel="L";
53     this.qrid=0;
54     this.oWidth=0;
55     this.oHeight=0;
56     this.kisscuts=0;
57     this.diecuts=0;
58     this.pixResX=0;
59     this.pixResY=0;
60     this.is123rf=0;
61     this.credits123rf=0;
62     this.license123rf=0;
63     this.id123rf=0;
64     this.marginleft=0;
65     this.margintop=0;
66     this.marginright=0;
67     this.marginbottom=0;
68     this.cropID=0;
69     this.cropRotation=0;
70     this.cropimg="";
71     this.mirror=0;
72     this.usecurrentdimensions=0;
73     this.picWidth=0;
74     this.picHeight=0;
75     this.isArchive=0;
76     this.zorder=0;
77     this.locked=0;
78     this.elementprice=0;
79     this.orderprice=0;
80     this.colorchanges=0;
81     this.movingTopBottom=0;
82     this.memo="";
83     this.pintoback=0;
84     this.tooltip="";
85     this.foildeleted=0;
86     this.isCutout=0;
87     this.cornerradius=0;
88     this.shapetype =1;
89     this.lineType=1;
90     this.lineCurves=0;
91     this.shapeid=0;
92     this.lockOutlineWidth=0;
93     this.nonprinting=0;
94     this.hideprops=0;
95     this.mailmemo=0;
96     this.cutoutshape=0;
97     this.seriesLetter=0;
98     this.seriesType=0;
99     this.foilwidth=0;
100     this.maxdimensionswarned=0;
101     this.usesvg=0;
102     this.barcodetype=0;
103     this.openexisting=0;
104     this.clipoutline=0;
105     this.isPaintmask=0;
106     this.textcurveradius=0;
107     this.textcurvedirection=0;
108     this.textcurverotation=0;
109     this.multiselected=0;
110     this.multileft=0;
111     this.multitop=0;
112     this.multiwidth=0;
113     this.multiheight=0;
114     this.pixelshape=0;
115     this.isProjectID=0;
116     this.elementFillID=0;
117     this.outlineFillID=0;
118     this.outlinecolorname='';
119     this.isdroptarget=0;
120     this.elementuploadID=0;
121     this.v3uploadtimer=0;
122     this.curvewidthratio=1;
123     this.qrlogosize=0;
124     this.qrframesize=0;
125     this.qrlogoid=0;
126     this.pixelsize=0;
127     this.replaceQRTimer=0;
128     this.effect=new effects();
129     this.hasEffect=0;
130     this.variablecorners='';
131     this.placeascutting=0;
132     this.group=0;
133     this.nosavepattern=0;
134     this.clientpath='';
135     this.outlinetoobject=0;
136     this.toXml=function toXml() {
137          var xml="<element>";
138          xml+="<elementtype>"+this.elementtype+"</elementtype>";
139          xml+="<x>"+this.left.toFixed(2)+"</x>"
140          xml+="<y>"+this.top.toFixed(2)+"</y>"
141          xml+="<width>"+this.width.toFixed(2)+"</width>"
142          xml+="<height>"+this.height.toFixed(2)+"</height>"
143          xml+="<rotation>"+this.rotation+"</rotation>"
144          var myindex=this.zindex-9;
145          xml+="<zindex>"+myindex+"</zindex>"
146          xml+="<font>"+this.font+"</font>"
147          xml+="<fontid>"+this.fontid+"</fontid>"
148          xml+="<fontdisplayname>"+this.fontdisplayname+"</fontdisplayname>"
149          xml+="<fontsize>"+this.letterheight+"</fontsize>"
150
151          var t1=this.text.replace(/€/g,"$$$|").replace(/&/g,"$||").replace(/\+/g,"_plus_").replace(/\u20ac/g,'$$$|');
152          xml+="<text><![CDATA["+t1+"]]></text>"
153          xml+="<textid>"+this.textid+"</textid>"
154          xml+="<filename>"+this.filesource+"</filename>"
155          xml+="<bold>"+this.bold+"</bold>"
156          xml+="<italic>"+this.italic+"</italic>"
157          xml+="<alignment>"+this.alignment+"</alignment>"
158          xml+="<libraryid>"+this.libraryID+"</libraryid>"
159          xml+="<margintop>"+this.margintop+"</margintop>"
160          xml+="<marginleft>"+this.marginleft+"</marginleft>"
161          xml+="<marginright>"+this.marginright+"</marginright>"
162          xml+="<marginbottom>"+this.marginbottom+"</marginbottom>"
163          xml+="<cropID>"+this.cropID+"</cropID>"
164          xml+="<croprotation>"+this.cropRotation+"</croprotation>"
165          if(this.cropimg.substr(0,8)=="/archive") {
166               xml+="<cropimg>"+this.cropimg.substr(8)+"</cropimg>"
167          } else {
168               xml+="<cropimg>"+this.cropimg+"</cropimg>"
169          }
170          xml+="<mirror>"+this.mirror+"</mirror>"
171          xml+="<owidth>"+this.oWidth+"</owidth>"
172          xml+="<oheight>"+this.oHeight+"</oheight>"
173          xml+="<is123rf>"+this.is123rf+"</is123rf>"
174          xml+="<credits123rf>"+this.credits123rf+"</credits123rf>"
175          xml+="<license123rf>"+this.license123rf+"</license123rf>"
176          xml+="<id123rf>"+this.id123rf+"</id123rf>"
177          xml+="<hascolor>"+this.hasColor+"</hascolor>"
178          xml+="<colorname>"+this.colorname+"</colorname>"
179          xml+="<color>"+this.color+"</color>"
180          xml+="<kisscuts>"+this.kisscuts+"</kisscuts>"
181          xml+="<diecuts>"+this.diecuts+"</diecuts>"
182          xml+="<uploadid>"+this.uploadID+"</uploadid>"
183          xml+="<qrid>"+this.qrid+"</qrid>"
184          xml+="<hwratio>"+this.hwRatioOriginal+"</hwratio>"
185          xml+="<tlratio>"+this.tlRatio+"</tlratio>"
186          xml+="<zorder>"+this.zorder+"</zorder>"
187          xml+="<locked>"+this.locked+"</locked>"
188          xml+="<elementprice>"+this.elementprice+"</elementprice>"
189          xml+="<orderprice>"+this.orderprice+"</orderprice>"
190          xml+="<shapeid>"+this.shapeid+"</shapeid>"
191          xml+="<shapetype>"+this.shapetype+"</shapetype>"
192          xml+="<lineType>"+this.lineType+"</lineType>"
193          xml+="<lineCurves>"+this.lineCurves+"</lineCurves>"
194          xml+="<cornerradius>"+this.cornerradius+"</cornerradius>"
195          xml+="<nonprinting>"+this.nonprinting+"</nonprinting>"
196          xml+="<isprojectid>"+this.isProjectID+"</isprojectid>"
197		xml+="<elementfillid>"+this.elementFillID+"</elementfillid>"
198		xml+="<outlinefillid>"+this.outlineFillID+"</outlinefillid>"
199		xml+="<hideprops>"+this.hideprops+"</hideprops>"
200		xml+="<mailmemo>"+this.mailmemo+"</mailmemo>"
201		xml+="<cutoutshape>"+this.cutoutshape+"</cutoutshape>"
202		xml+="<barcodetype>"+this.barcodetype+"</barcodetype>"
203		xml+="<seriesletter>"+this.seriesLetter+"</seriesletter>"
204		xml+="<seriesType>"+this.seriesType+"</seriesType>"
205		xml+="<isdroptarget>"+this.isdroptarget+"</isdroptarget>"
206		xml+="<textsvg>"+this.usesvg+"</textsvg>"
207		xml+="<clipoutline>"+this.clipoutline+"</clipoutline>"
208		xml+="<textcurveradius>"+this.textcurveradius+"</textcurveradius>"
209		xml+="<textcurvedirection>"+this.textcurvedirection+"</textcurvedirection>"
210		xml+="<textcurverotation>"+this.textcurverotation+"</textcurverotation>"
211		xml+="<pintoback>"+this.pintoback+"</pintoback>";                                                                                                                                                                    xml+="<transparency>"+this.transparency+"</transparency>"
212		                                                                                                                                                                                              xml+="<qrlogosize>"+this.qrlogosize+"</qrlogosize>";
213          xml+="<qrframesize>"+this.qrframesize+"</qrframesize>";
214          xml+="<qrlogoid>"+this.qrlogoid+"</qrlogoid>";
215          xml+="<pixelsize>"+this.pixelsize+"</pixelsize>";
216          xml+="<variablecorners>"+this.variablecorners+"</variablecorners>";
217          xml+="<placeascutting>"+this.placeascutting+"</placeascutting>";
218          xml+="<group>"+this.group+"</group>";
219          xml+="<outlinetoobject>"+this.outlinetoobject+"</outlinetoobject>";
220          t1=this.memo.replace(/€/g,"$$$|").replace(/&/g,"$||").replace(/\+/g,"_plus_").replace(/\u20ac/g,'$$$|');
221          xml+="<memo><![CDATA["+t1+"]]></memo>"
222          if(this.elementtype==5) {
223               xml+="<protocol>"+this.protocol+"</protocol>";
224               xml+="<qualitylevel>
224"+this.qualitylevel+"</qualitylevel>";
225               xml+="<pixelshape>"+this.pixelshape+"</pixelshape>"
226          } else {
227               xml+="<protocol></protocol>";
228               xml+="<qualitylevel></qualitylevel>";
229               xml+="<pixelshape></pixelshape>"
230          }
231          if(this.useOutline==1) {
232               xml+="<useOutline>1</useOutline>";
233               xml+="<outlinecolor>"+this.outlinecolor+"</outlinecolor>";
234               xml+="<outlinecolorname>"+this.outlinecolorname+"</outlinecolorname>";
235               xml+="<origOutlinecolor>"+this.origOutlinecolor+"</origOutlinecolor>";
236               xml+="<origOutlinecolorname>"+this.origOutlinecolorname+"</origOutlinecolorname>";
237               xml+="<outlinewidth>"+this.outlinewidth+"</outlinewidth>";
238          } else {
239               xml+="<useOutline>0</useOutline>";
240               xml+="<outlinecolor></outlinecolor>";
241               xml+="<outlinecolorname></outlinecolorname>";
242               xml+="<origOutlinecolor></origOutlinecolor>";
243               xml+="<origOutlinecolorname></origOutlinecolorname>";
244               xml+="<outlinewidth>0</outlinewidth>"
245          }
246          if(this.effect.hasEffect()) {
247               xml+="<haseffect>1</haseffect>";
248               xml+=this.effect.toXML();
249          } else {
250               xml+="<haseffect>0</haseffect>";
251          }
252          xml+="</element>";
253          return xml;
254     }
255     this.openText=function openText(elementid,zindex,x,y,width,height,rotation,mirror,tlratio,font,colorname,color,alignment,text,bold,italic,displayname,fontid,hwratio,textid,fontminimum,lhfactor) {
256          this.elementid=elementid;
257          this.zindex=elementid+10;
258          this.elementtype=2;
259          this.letterheight=height/tlratio;
260          this.fontdisplayname=displayname;
261          this.fontminimum=fontminimum;
262          this.lhfactor=lhfactor;
263          myModule.currentFontMinimum=fontminimum;
264          this.fontid=fontid;
265          this.bold=bold;
266          this.italic=italic;
267          myModule.currentLetterheight=this.letterheight;
268          this.font=font
269                    this.colorname=colorname;
270          this.color=color;
271          this.hasColor=1;
272          this.alignment=alignment;
273          this.text=text.replace(/##@/g,"€");
274          this.textid=textid;
275          this.hwRatio=hwratio;
276          this.hwRatioOriginal=hwratio;
277          if(hwratio==0) {
278               this.hwRatio=height/width;
279               this.hwRatioOriginal=height/width;
280          }
281          if(myModule.designtype==3 || myModule.designtype==5) {
282               $(".v3foilfield").each(function() {
283                    if($(this).data("foilname")==thisElement.colorname) {
284                         thisElement.foilwidth=$(this).children().first().data("maxdimension");
285                    }
286               })
287          }
288          this.tlRatio=tlratio;
289          var lh=this.letterheight/myModule.height*myModule.pxhoogte;
290          var ph=lh*tlratio;
291          var pb=ph/hwratio;
292          this.width=width;
293          this.height=height;
294          this.rotation=rotation;
295          this.mirror=mirror;
296          if(this.effect.hasEffect()) {}
297          if(this.usesvg=="1") {
298               $("<object id='element"+thisElement.elementid+"' class='v3element v3textelement' style='overflow:visible;z-index:"+thisElement.zindex+";width:"+myModule.size2pix(width)+"px;height:"+myModule.size2pix(height)+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass'  id='elementimage"+thisElement.elementid+"' onload='myModule.changecolor("+thisElement.elementid+")'></object>").insertAfter($("#v3buttonlayer"));
299               $("#element"+thisElement.elementid).load('/teksten/'+textid+'.svg',function() {
300                    myModule.changecolor(thisElement.elementid)
301               })
302          } else {
303               if(this.effect.hasCropEffect()) {
304                    $("<div id='element"+this.elementid+"' class='v3element v3textelement' style='overflow:visible;z-index:"+this.zindex+";width:"+myModule.size2pix(width)+"px;height:"+myModule.size2pix(height)+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/teksten/"+textid+".png' id='elementimage"+this.elementid+"' ></div>").insertAfter($("#v3buttonlayer"));
305               } else {
306                    $("<div id='element"+this.elementid+"' class='v3element v3textelement' style='overflow:visible;z-index:"+this.zindex+";width:"+myModule.size2pix(width)+"px;height:"+myModule.size2pix(height)+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/teksten/"+textid+".png' id='elementimage"+this.elementid+"' onload='myModule.changecolor("+this.elementid+")' ></div>").insertAfter($("#v3buttonlayer"));
307               }
308          }
309          var pl=myModule.left2pix(x);
310          var pt=myModule.top2pix(y);
311          $("#element"+this.elementid).css("left",pl);
312          $("#element"+this.elementid).css("top",pt);
313          this.setTransform();
314          if(this.usesvg=="1") {
315               this.filesource="/teksten/"+textid+".svg";
316          } else {
317               this.filesource="/teksten/"+textid+".png";
318          }
319          this.left=x;
320          this.top=y;
321          this.setPropdiv();
322          myModule.setCurrentProps();
323          myModule.updateprops();
324          this.visibleElement=$("#element"+this.elementid);
325          this.setTransparency();
326          //selectwindow.attachToElement(thisElement)
327          //setTimeout(colorQr,200);
328          //this.changeColor(this.color,this.colorname);
329          myModule.opencounter-=1;
330          myModule.countOpen();
331     }
332     this.openShape=function openShape(elementid,zindex,x,y,width,height,rotation,mirror,colorname,color,hasColor,displayname,shapeid) {
333
334          this.elementid=elementid;
335          this.zindex=elementid+10;
336          this.elementtype=1;
337          this.colorname=colorname;
338          this.color=color;
339          this.hasColor=hasColor;
340          this.shapeid=shapeid;
341          this.hwRatio=height/width;
342          this.hwRatioOriginal=height/width;
343          if(myModule.designtype==3 || myModule.designtype==5) {
344               $(".v3foilfield").each(function() {
345                    if($(this).data("foilname")==thisElement.colorname) {
346                         thisElement.foilwidth=$(this).children().first().data("maxdimension");
347                    }
348               })
349          }
350          this.width=width;
351          this.height=height;
352          this.rotation=rotation;
353          this.mirror=mirror;
354          if(this.effect.hasCropEffect()) {
355               $("<div id='element"+this.elementid+"' class='v3element v3textelement' style='z-index:"+this.zindex+";width:"+myModule.size2pix(width)+"px;height:"+myModule.size2pix(height)+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/teksten/shape"+shapeid+".png' id='elementimage"+this.elementid+"' ></div>").insertAfter($("#v3buttonlayer"));
356          } else {
357               $("<div id='element"+this.elementid+"' class='v3element v3textelement' style='z-index:"+this.zindex+";width:"+myModule.size2pix(width)+"px;height:"+myModule.size2pix(height)+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/teksten/shape"+shapeid+".png' id='elementimage"+this.elementid+"' onload='myModule.changecolor("+this.elementid+")' ></div>").insertAfter($("#v3buttonlayer"));
358          }
359          var pl=myModule.left2pix(x);
360          var pt=myModule.top2pix(y);
361          $("#element"+this.elementid).css("left",pl);
362          $("#element"+this.elementid).css("top",pt);
363          this.setTransform();
364          this.filesource="/teksten/shape"+shapeid+".png";
365          this.left=x;
366          this.top=y;
367          this.setPropdiv();
368          myModule.setCurrentProps();
369          myModule.updateprops();
370          this.visibleElement=$("#element"+this.elementid);
371          this.setTransparency();
372          if(this.isdroptarget==1) {
373               this.setAsDroptarget();
374          }
375          myModule.opencounter-=1;
376          myModule.countOpen();
377
378     }
379     this.addShape=function addShape(elementid,width,height,linewidth,cornerradius,backgroundcolorname, backgroundcolor,outlinecolorname, outlinecolor, shapetype,lineType,lineCurves,variablecorners,placeascutting) {
380          this.elementid=elementid;
381          this.zindex=elementid+10;
382          this.elementtype=1;
383          this.width=width;
384          this.height=height;
385          this.cornerradius=cornerradius;
386          this.colorname=backgroundcolorname;
387          this.color=backgroundcolor;
388          linewidth=linewidth||0;
389          this.outlinewidth=linewidth;
390          this.useOutline=linewidth>0;
391          outlinecolorname=outlinecolorname||"";
392          outlinecolor=outlinecolor||"";
393          this.oldOutlinecolor=outlinecolor;
394          this.origOutlinecolor=outlinecolor;
395          this.outlinecolor=outlinecolor;
396          this.outlinecolorname=outlinecolorname;
397          this.oldOutlinecolorname=outlinecolorname;
398          this.origOutlinecolorname=outlinecolorname;
399          this.shapetype=shapetype;
400          this.hwRatio=height/width;
401          this.hasColor=backgroundcolorname!="Transparent";
402          this.lineType=lineType;
403          this.lineCurves=lineCurves;
404          this.variablecorners=variablecorners;
405          this.placeascutting=placeascutting;
406          if(placeascutting==1){
407          	this.kisscuts=1;
408          	this.diecuts=0;
409          }else if(placeascutting==2){
410          	this.diecuts=1;
411          	this.kisscuts=0;
412          }else{
413          	this.kisscuts=0;
414          	this.diecuts=0;
415          }
416          if(myModule.designtype==3 || myModule.designtype==5) {
417               $(".v3foilfield").each(function() {
418                    if($(this).data("foilname")==thisElement.colorname) {
419                         thisElement.foilwidth=$(this).children().first().data("maxdimension");
420                    }
421               })
422          }
423          var xml="postdata=<?xml version='1.0'?><root>";
424          xml+="<width>"+width+"</width>";
425          xml+="<height>"+height+"</height>";
426          xml+="<outlinewidth>"+linewidth+"</outlinewidth>";
427          xml+="<cornerradius>"+cornerradius+"</cornerradius>";
428          xml+="<backgroundcolor>"+backgroundcolorname+"</backgroundcolor>";
429          xml+="<outlinecolor>"+outlinecolorname+"</outlinecolor>";
430          xml+="<shapetype>"+shapetype+"</shapetype>";
431          xml+="<lineType>"+lineType+"</lineType>";
432          xml+="<lineCurves>"+lineCurves+"</lineCurves>";
433          xml+="<variablecorners>"+variablecorners+"</variablecorners>";
434          xml+="<placeascutting>"+placeascutting+"</placeascutting>";
435          xml+="<designtype>"+myModule.designtype+"</designtype>";
436          if(this.effect.hasEffect()) {
437               xml+="<haseffect>1</haseffect>";
438               xml+=this.effect.toXML();
439          } else {
440               xml+="<haseffect>0</haseffect>";
441          }
442          xml+="</root>";
443          $.ajax({
444			type: "POST",
445			dataType: "xml",
446			Content_type:"text/html; charset=utf-8",
447			data: xml,
448			cache: false,
449			url: "/123v3/shape.php",
450			success: function(xml) {
451                    thisElement.startwaitloop(1,$(xml).find("shapeid").text())
452               }
453          });
454     }
455     this.addText = function addText(elementid,letterheight,font,colorname,color,alignment,text,fontweight,displayname,fontid,fontminimum,lhfactor,usecurrentdimensions,useOutline,outlinecolorname,outlinecolor,outlinewidth,cutoutshape,textcurveradius,textcurvedirection,textcurverotation) {
456          textcurveradius=textcurveradius||0;
457          textcurvedirection=textcurvedirection||0;
458          textcurverotation=textcurverotation||0;
459          this.elementid=elementid;
460          this.zindex=elementid+10;
461          this.elementtype=2;
462          this.letterheight=letterheight;
463          this.fontdisplayname=displayname;
464          this.fontid=fontid;
465          this.fontminimum=fontminimum;
466          this.lhfactor=lhfactor;
467          this.textcurveradius=textcurveradius;
468          this.textcurvedirection=textcurvedirection;
469          this.textcurverotation=textcurverotation;
470          this.bold=0;
471          this.italic=0;
472          this.usecurrentdimensions=usecurrentdimensions;
473          if(fontweight==1 || fontweight==3) {
474               this.bold=1;
475          }
476          if(fontweight==2 || fontweight==3) {
477               this.italic=1;
478          }
479
480
481          this.font=font;
482          this.colorname=colorname;
483          this.color=color;
484          this.hasColor=1;
485          this.alignment=alignment;
486          this.text=text;
487          useOutline=useOutline||0;
488          outlinecolorname=outlinecolorname||"";
489          outlinecolor=outlinecolor||"";
490          outlinewidth=outlinewidth||0;
491          this.useOutline=useOutline;
492          this.outlinecolor=outlinecolor;
493          this.oldOutlinecolor=outlinecolor;
494          this.origOutlinecolor=outlinecolor;
495          this.outlinecolorname=outlinecolorname;
496          this.oldOutlinecolorname=outlinecolorname;
497          this.origOutlinecolorname=outlinecolorname;
498          this.outlinewidth=outlinewidth;
499          this.cutoutshape=cutoutshape;
500          if(myModule.designtype==3 || myModule.designtype==5) {
501               $(".v3foilfield").each(function() {
502                    if($(this).data("foilname")==thisElement.colorname) {
503                         thisElement.foilwidth=$(this).children().first().data("maxdimension");
504                    }
505               })
506          }
507          var t1=this.text.replace(/€/g,"$$$|").replace(/&/g,"$||").replace(/\+/g,"_plus_").replace(/\u20ac/g,'$$$|');
508          var xml="postdata=<?xml version='1.0'?><root><tekst><![CDATA["+t1+"]]></tekst>";
509          xml+="<font>"+this.font+"</font>";
510          var sendalignment=this.alignment-1;
511          xml+="<align>"+sendalignment+"</align>";
512          xml+="<bold>"+this.bold+"</bold>";
513          xml+="<italic>"+this.italic+"</italic>";
514          xml+="<color>"+this.colorname+"</color>";
515          xml+="<useoutline>"+this.useOutline+"</useoutline>";
516          xml+="<outlinecolor>"+this.outlinecolorname+"</outlinecolor>";
517          xml+="<outlinewidth>"+this.outlinewidth+"</outlinewidth>";
518          xml+="<designtype>"+myModule.designtype+"</designtype>";
519          xml+="<letterheight>"+letterheight+"</letterheight>";
520          xml+="<textcurveradius>"+textcurveradius+"</textcurveradius>";
521          xml+="<textcurvedirection>"+textcurvedirection+"</textcurvedirection>";
522          xml+="<textcurverotation>"+textcurverotation+"</textcurverotation>";
523          xml+="<elementFillID>"+this.elementFillID+"</elementFillID>";
524          xml+="<outlineFillID>"+this.outlineFillID+"</outlineFillID>";
525          if(this.effect.hasEffect()) {
526               xml+="<haseffect>1</haseffect>";
527               xml+=this.effect.toXML();
528          } else {
529               xml+="<haseffect>0</haseffect>";
530          }
531          xml+="</root>";
532          //xml=encodeURI(xml);
533          $.ajax({
534			type: "POST",
535			dataType: "xml",
536			Content_type:"text/html; charset=utf-8",
537			data: xml,
538			cache: false,
539			url: "/123v3/text.php",
540			success: function(xml) {
541                    thisElement.startwaitloop(2,$(xml).find("textid").text())
542               }
543          });
544     }
545     this.addShapeExisting = function addShapeExisting(elementid,zindex,colorname,color,x,y,width,height,rotation,mirror,useOutline,outlinecolorname,outlinecolor,outlinewidth,shapetype,hasColor, cornerRadius,copyfrom) {
546          copyfrom=copyfrom||0;
547          this.elementid=elementid;
548          this.zindex=elementid+10;
549          this.elementtype=1;
550          this.top=y;
551          this.left=x;
552          this.width=width;
553          this.height=height;
554          this.rotation=rotation;
555          this.mirror=mirror;
556          this.usecurrentdimensions=1;
557          this.shapetype=shapetype;
558          this.colorname=colorname;
559          this.color=color;
560          this.hasColor=hasColor;
561          useOutline=useOutline||0;
562          outlinecolorname=outlinecolorname||"";
563          outlinecolor=outlinecolor||"";
564          outlinewidth=outlinewidth||0;
565          this.useOutline=useOutline;
566          this.outlinecolor=outlinecolor;
567          this.oldOutlinecolor=outlinecolor;
568          this.origOutlinecolor=outlinecolor;
569          this.outlinecolorname=outlinecolorname;
570          this.oldOutlinecolorname=outlinecolorname;
571          this.origOutlinecolorname=outlinecolorname;
572          this.outlinewidth=outlinewidth;
573          this.cornerradius=cornerRadius
574          this.setPropdiv();
575          this.lockRatio=1;
576          this.openexisting=1;
577          var xml="postdata=<?xml version='1.0'?><root>";
578          xml+="<width>"+width+"</width>";
579          xml+="<height>"+height+"</height>";
580          xml+="<outlinewidth>"+outlinewidth+"</outlinewidth>";
581          xml+="<cornerradius>"+cornerRadius+"</cornerradius>";
582          xml+="<backgroundcolor>"+colorname+"</backgroundcolor>";
583          xml+="<outlinecolor>"+outlinecolorname+"</outlinecolor>";
584          xml+="<shapetype>"+shapetype+"</shapetype>";
585          xml+="<designtype>"+myModule.designtype+"</designtype>";
586          xml+="<elementfillid>"+this.elementFillID+"</elementfillid>";
587          xml+="<outlinefillid>"+this.outlineFillID+"</outlinefillid>";
588          xml+="<filloutline>"+myModule.otherfillOutline+"</filloutline>";
589          xml+="<lineType>"+this.lineType+"</lineType>";
590          xml+="<lineCurves>"+this.lineCurves+"</lineCurves>";
591          xml+="<variablecorners>"+this.variablecorners+"</variablecorners>";
592          xml+="<placeascutting>"+this.placeascutting+"</placeascutting>";
593          xml+="<copyfrom>"+copyfrom+"</copyfrom>"
594          if(this.effect.hasEffect()) {
595               xml+="<haseffect>1</haseffect>";
596               xml+=this.effect.toXML();
597          } else {
598               xml+="<haseffect>0</haseffect>";
599          }
600          xml+="</root>";
601          $.ajax({
602			type: "POST",
603			dataType: "xml",
604			data: xml,
605			cache: false,
606			contentType: "application/x-www-form-urlencoded;charset=UTF-8",
607			url: "/123v3/shape.php",
608			success: function(xml) {
609                    thisElement.startwaitloop(1,$(xml).find("shapeid").text())
610               }
611          });
612     }
613
614     this.addTextExisting = function addTextExisting(elementid,zindex,letterheight,font,colorname,color,alignment,text,fontweight,displayname,fontid,x,y,width,height,rotation,mirror,fontminimum,lhfactor,useOutline,outlinecolorname,outlinecolor,outlinewidth,textcurveradius,textcurvedirection,textcurverotation,copyfrom) {
615          textcurveradius=textcurveradius||0;
616          textcurvedirection=textcurvedirection||0;
617          textcurverotation=textcurverotation||0;
618          copyfrom=copyfrom||0
619          this.elementid=elementid;
620          this.zindex=elementid+10;
621          this.elementtype=2;
622          this.letterheight=letterheight;
623          this.fontdisplayname=displayname;
624          this.fontminimum=fontminimum;
625          this.lhfactor=lhfactor;
626          myModule.currentFontMinimum=fontminimum;
627          this.fontid=fontid;
628          this.top=y;
629          this.left=x;
630          this.width=width;
631          this.height=height;
632          this.rotation=rotation;
633          this.mirror=mirror;
634          this.bold=0;
635          this.italic=0;
636          this.usecurrentdimensions=1;
637          if(fontweight==1 || fontweight==3) {
638               this.bold=1;
639          }
640          if(fontweight==2 || fontweight==3) {
641               this.italic=1;
642          }
643          myModule.currentLetterheight=letterheight;
644          this.font=font
645          this.colorname=colorname;
646          this.color=color;
647          this.hasColor=1;
648          this.alignment=alignment;
649          this.text=text.replace(/##@/g,"€");
650          useOutline=useOutline||0;
651          outlinecolorname=outlinecolorname||"";
652          outlinecolor=outlinecolor||"";
653          outlinewidth=outlinewidth||0;
654          this.useOutline=useOutline;
655          this.outlinecolor=outlinecolor;
656          this.oldOutlinecolor=outlinecolor;
657          this.origOutlinecolor=outlinecolor;
658          this.outlinecolorname=outlinecolorname;
659          this.oldOutlinecolorname=outlinecolorname;
660          this.origOutlinecolorname=outlinecolorname;
661          this.textcurveradius=textcurveradius;
662          this.textcurvedirection=textcurvedirection;
663          this.textcurverotation=textcurverotation;
664          this.outlinewidth=outlinewidth;
665          this.openexisting=1;
666          if(myModule.designtype==3 || myModule.designtype==5) {
667               $(".v3foilfield").each(function() {
668                    if($(this).data("foilname")==thisElement.colorname) {
669                         thisElement.foilwidth=$(this).children().first().data("maxdimension");
670                    }
671               })
672          }
673          this.setPropdiv();
674          //var t1=this.text.replace(/€/g,"$$$|").replace(/&/g,"$||").replace(/\+/g,"_plus_");
675          var t1=this.text.replace(/€/g,"$$$|").replace(/&/g,"$||").replace(/\+/g,"_plus_").replace(/\u20ac/g,'$$$|');
676          var xml="postdata=<?xml version='1.0' encoding='UTF-8'?><root><tekst><![CDATA["+t1+"]]></tekst>";
677          xml+="<font>"+this.font+"</font>";
678          var sendalignment=this.alignment-1;
679          xml+="<align>"+sendalignment+"</align>";
680          xml+="<bold>"+this.bold+"</bold>";
681          xml+="<italic>"+this.italic+"</italic>";
682          xml+="<color>"+this.colorname+"</color>";
683          xml+="<useoutline>"+this.useOutline+"</useoutline>";
684          xml+="<outlinecolor>"+this.outlinecolorname+"</outlinecolor>"
685          xml+="<outlinewidth>"+this.outlinewidth+"</outlinewidth>"
686          xml+="<designtype>"+myModule.designtype+"</designtype>";
687          xml+="<letterheight>"+this.letterheight+"</letterheight>"
688          xml+="<textcurveradius>"+textcurveradius+"</textcurveradius>"
689          xml+="<textcurvedirection>"+textcurvedirection+"</textcurvedirection>"
690          xml+="<textcurverotation>"+textcurverotation+"</textcurverotation>"
691          xml+="<elementFillID>"+this.elementFillID+"</elementFillID>"
692          xml+="<outlineFillID>"+this.outlineFillID+"</outlineFillID>"
693          xml+="<copyfrom>"+copyfrom+"</copyfrom>"
694          if(this.effect.hasEffect()) {
695               xml+="<haseffect>1</haseffect>";
696               xml+=this.effect.toXML();
697          } else {
698               xml+="<haseffect>0</haseffect>";
699          }
700          xml+="</root>";
701
702          $.ajax({
703			type: "POST",
704			dataType: "xml",
705			data: xml,
706			cache: false,
707			contentType: "application/x-www-form-urlencoded;charset=UTF-8",
708			url: "/123v3/text.php",
709			success: function(xml) {
710                    thisElement.startwaitloop(2,$(xml).find("textid").text())
711               }
712          });
713     }
714     this.openQr=function openQr(elementid,zindex,x,y,width,height,rotation,mirror,text,protocol,colorname,color,qualitylevel,qrid) {
715          this.elementid=elementid;
716          this.hasColor=1;
717          this.zindex=elementid+10;
718          this.elementtype=5;
719          this.colorname=colorname;
720          this.color=color;
721          this.text=text;
722          this.protocol=protocol;
723          this.hwRatio=height/width;
724          this.hwRatioOriginal=1;
725          this.qualitylevel=qualitylevel;
726          this.qrid=qrid;
727          this.filesource="qr"+qrid+".png"
728                          this.width=width;
729          this.height=height;
730          this.rotation=rotation;
731          this.mirror=mirror;
732          var lb=myModule.size2pix(height);
733          var lh=myModule.size2pix(width);
734          if(this.qrlogoid>0) {
735               $("<div id='element"+thisElement.elementid+"' class='v3element v3textelement' style='z-index:"+thisElement.zindex+";width:"+lh+"px;height:"+lb+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3qrclass' src='/clientfiles/qr"+qrid+".png' id='elementimage"+thisElement.elementid+"'></div>").insertAfter($("#v3buttonlayer"));
736          } else {
737               $("<div id='element"+thisElement.elementid+"' class='v3element v3textelement' style='z-index:"+thisElement.zindex+";width:"+lh+"px;height:"+lb+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3qrclass' src='/clientfiles/qr"+qrid+".png' id='elementimage"+thisElement.elementid+"' onload='myModule.changecolor("+this.elementid+")' ></div>").insertAfter($("#v3buttonlayer"));
738          }
739          var pl=myModule.left2pix(x);
740          var pt=myModule.top2pix(y);
741          $("#element"+this.elementid).css("left",pl);
742          $("#element"+this.elementid).css("top",pt);
743          this.setTransform();
744          this.left=x;
745          this.top=y;
746          thisElement.setPropdiv();
747          myModule.setCurrentProps();
748          myModule.updateprops();
749          thisElement.visibleElement=$("#element"+thisElement.elementid);
750          thisElement.setTransparency();
751          //selectwindow.attachToElement(thisElement)
752          //this.changeColor(this.color,this.colorname);
753          myModule.opencounter-=1;
754          myModule.countOpen();
755     }
756     this.AddQrExisting=function AddQrExisting(elementid,zindex,x,y,width,height,rotation,mirror,text,protocol,colorname,color,qualitylevel,qrid,copyfrom) {
757     	copyfrom=copyfrom||0
758          this.elementid=elementid;
759          this.hasColor=1;
760          this.zindex=elementid+10;
761          this.elementtype=5;
762          this.colorname=colorname;
763          this.color=color;
764          this.text=text;
765          this.protocol=protocol;
766          this.hwRatio=height/width;
767          this.hwRatioOriginal=1;
768          this.qualitylevel=qualitylevel;
769          this.qrid=qrid;
770          this.width=width;
771          this.height=height;
772          this.rotation=rotation;
773          this.mirror=mirror;
774          this.filesource="qr"+qrid+".png";
775          this.left=x;
776          this.top=y;
777          this.usecurrentdimensions=1;
778          this.openexisting=1;
779          this.setPropdiv();
780
781
782          var xml="postdata=<root><tekst><![CDATA["+this.text.replace(/&/g,"@amp@")+"]]></tekst>";
783          xml+="<qualitylevel>"+this.qualitylevel+"</qualitylevel>";
784          xml+="<pixelshape>"+this.pixelshape+"</pixelshape>";
785          xml+="<color>"+this.colorname+"</color>";
786          xml+="<framesize>"+this.qrframesize+"</framesize>";
787          xml+="<logosize>"+this.qrlogosize+"</logosize>";
788          xml+="<newupload>0</newupload>";
789          xml+="<uploadID>"+this.qrlogoid+"</uploadID>";
790          xml+="<barcodetype>"+this.barcodetype+"</barcodetype>";
791          xml+="<copyfrom>"+copyfrom+"</copyfrom></root>"
792          $.ajax({
793			type: "POST",
794			dataType: "xml",
795			data: xml,
796			cache: false,
797			url: "/123v3/qr.php",
798			success: function(xml) {
799			     thisElement.startwaitloop(5,$(xml).find("qrid").text())
800               }
801          });
802
803     }
804
805     this.addQr=function(elementid,text,protocol,colorname,color,qualitylevel,barcodetype,pixelshape) {
806          this.elementid=elementid;
807          this.zindex=elementid+10;
808          this.elementtype=5;
809          this.colorname=colorname;
810          this.color=color;
811          this.barcodetype=barcodetype;
812          this.hasColor=1;
813          this.text=text;
814          this.protocol=protocol;
815          this.hwRatio=1
816                       this.hwRatioOriginal=1;
817          this.qualitylevel=qualitylevel;
818          this.pixelshape=pixelshape;
819          var xml="postdata=<root><tekst><![CDATA["+this.text.replace(/&/g,"@amp@")+"]]></tekst>";
820          xml+="<qualitylevel>"+this.qualitylevel+"</qualitylevel>";
821          xml+="<pixelshape>"+this.pixelshape+"</pixelshape>";
822          xml+="<color>"+this.colorname+"</color>";
823          xml+="<barcodetype>"+this.barcodetype+"</barcodetype></root>";
824          $.ajax({
825			type: "POST",
826			dataType: "xml",
827			data: xml,
828			cache: false,
829			url: "/123v3/qr.php",
830			success: function(xml) {
831                    thisElement.startwaitloop(5,$(xml).find("qrid").text())
832               }
833          });
834     }
835     this.addQrDirect=function addQrDirect(elementid,texttoadd,protocol,colorname,color,qualitylevel,barcodetype,pixelshape,pixelsize,framesize,logosize,logoid,qrid) {
836          this.elementid=elementid;
837          this.zindex=elementid+10;
838          this.elementtype=5;
839          this.colorname=colorname;
840          this.color=color;
841          this.barcodetype=barcodetype;
842          this.hasColor=1;
843          this.text=texttoadd;
844          this.protocol=protocol;
845          this.hwRatio=1
846                       this.hwRatioOriginal=1;
847          this.qualitylevel=qualitylevel;
848          this.pixelshape=pixelshape;
849          this.pixelsize=pixelsize;
850          this.qrframesize=framesize;
851          this.qrlogosize=logosize;
852          this.qrlogoid=logoid;
853          this.qrid=qrid;
854          this.filesource="qr"+qrid+".png"
855                          this.hwRatio=1;
856          this.hwRatioOriginal=1
857                               var lh=0;
858          var lb=0;
859          if(this.usecurrentdimensions==1) {
860               lh=myModule.size2pix(thisElement.height);
861               lb=myModule.size2pix(thisElement.width);
862          } else {
863               if(thisElement.barcodetype==0) {
864                    lh=myModule.pxhoogte/2;
865                    lb=lh;
866                    this.width=myModule.pix2size(lb);
867                    this.height=myModule.pix2size(lh);
868               }
869          }
870          $("<div id='element"+this.elementid+"' class='v3element v3textelement' style='z-index:"+this.zindex+";width:"+lb+"px;height:"+lh+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3qrclass' src='/clientfiles/qr"+qrid+".png' id='elementimage"+this.elementid+"' ></div>").insertAfter($("#v3buttonlayer"));
871          var pl=0;
872          var pt=0;
873          var rot=0;
874          if(this.usecurrentdimensions==1) {
875               pl=myModule.left2pix(thisElement.left);
876               pt=myModule.top2pix(thisElement.top);
877               rot=thisElement.rotation;
878               this.filesource="/clientfiles/qr"+qrid+".png";
879          } else {
880               this.left = myModule.width/2-this.width/2;
881               this.top=myModule.height/2-this.height/2;
882               var pl=myModule.left2pix(this.left);
883               var pt=myModule.top2pix(this.top);
884          }
885          $("#element"+this.elementid).css("left",pl);
886          $("#element"+this.elementid).css("top",pt);
887          this.setTransform();
888          this.setPropdiv();
889          myModule.setCurrentProps();
890          myModule.updateprops();
891          this.visibleElement=$("#element"+thisElement.elementid);
892          selectwindow.attachToElement(thisElement)
893          myModule.ensureZorder()
894          if(myModule.designtype==3) {
895               myModule.checkFoilDeleted()
896          }
897
898     }
899     this.replaceQrDirect=function replaceQrDirect() {
900          var colorname=this.colorname;
901          var protocol='';
902          var qualitylevel=this.qualitylevel;
903          var pixelshape=this.pixelshape;
904          var framesize=this.qrframesize;
905          var logosize=this.qrlogosize;
906          var text=this.text;
907          myModule.showwarning(pops.qrwait,pops.wait)
908          var xml="postdata=<root><tekst><![CDATA["+text.replace(/&/g,"@amp@")+"]]></tekst>";
909          xml+="<qualitylevel>"+qualitylevel+"</qualitylevel>";
910          xml+="<pixelshape>"+pixelshape+"</pixelshape>";
911          xml+="<color>"+colorname+"</color>";
912          xml+="<framesize>"+framesize+"</framesize>";
913          xml+="<logosize>"+logosize+"</logosize>";
914          xml+="<newupload>0</newupload>";
915          xml+="<uploadID>"+this.qrlogoid+"</uploadID>";
916          xml+="<barcodetype>0</barcodetype></root>";
917          $.ajax({
918			type: "POST",
919			dataType: "xml",
920			data: xml,
921			cache: false,
922			url: "/123v3/qr.php",
923			success: function(xml) {
924                    thisElement.qrid=$(xml).find("qrid").text()
925                    thisElement.filesource="qr"+thisElement.qrid+".png"
926		          if(thisElement.replaceQrTimer>0){
927		          	clearInterval(thisElement.replaceQrTimer)
928		          }
929                     thisElement.replaceQrTimer=window.setInterval(analyseQR,500)
930               }
931          });
932     }
933     function analyseQR() {
934          xml='postdata=<root><elementType>5</elementType><id>'+thisElement.qrid+'</id></root>';
935
936          $.ajax({
937			type: "POST",
938			dataType: "xml",
939			data: xml,
940			cache: false,
941			url: "/123v3/elementready.php",
942			success: function(xml) {
943                    if($(xml).find("state").text()==1) {
944                         clearInterval(thisElement.replaceQrTimer);
945                         thisElement.replaceQrTimer=0
946                         var textid=$(xml).find("id").text();
947                         $("#elementimage"+thisElement.elementid).prop("src","/clientfiles/qr"+textid+".png")
948                         myModule.hidewarning()
949                         myModule.setCurrentProps();
950                         myModule.saveDesign(1)
951                    }
952                    if($(xml).find("state").text()==2) {
953                         clearInterval(thisElement.replaceQrTimer);
954                         thisElement.replaceQrTimer=0;
955                         myModule.hidewarning()
956                    }
957               }
958          });
959
960     }
961
962
963     this.addLibItemBackground=function addLibItemBackground(elementid,libraryID,simpleShape,image,hwRatio,color,colorname,kisscuts,diecuts,minWidth,minHeight,useOutline,outlinecolor,outlinecolorname,outlinewidth,width,height,left,top) {
964          this.elementid=elementid;
965          this.zindex=elementid+10;
966          this.elementtype=4;
967          this.libraryID=libraryID;
968          this.image=image;
969          this.hwRatio=hwRatio;
970          this.hwRatioOriginal=hwRatio;
971          this.hasColor=(simpleShape==1);
972          this.colorname=colorname;
973          this.color=color;
974          this.kisscuts=kisscuts;
975          this.diecuts=diecuts;
976          this.minwidth=minWidth;
977          this.minheight=minHeight;
978          var lh=myModule.pxhoogte/2;
979          useOutline=useOutline||0;
980          outlinecolorname=outlinecolorname||"";
981          outlinecolor=outlinecolor||"";
982          outlinewidth=outlinewidth||0;
983          this.useOutline=useOutline;
984          this.outlinecolor=outlinecolor;
985          this.oldOutlinecolor=outlinecolor;
986          this.origOutlinecolor=outlinecolor;
987          this.outlinecolorname=outlinecolorname;
988          this.oldOutlinecolorname=outlinecolorname;
989          this.origOutlinecolorname=outlinecolorname;
990          this.outlinewidth=outlinewidth;
991          this.width=(Number(myModule.width)+Number(myModule.bleed))*width;
992          this.height=(Number(myModule.width)+Number(myModule.bleed))*height
993          var pb=myModule.size2pix(this.width);
994          var ph=myModule.size2pix(this.height)
995          if(useOutline==0 && this.colorname.substr(0,1)!="E" && !this.effect.hasEffect()) {
996               $("<div id='element"+this.elementid+"' class='v3element v3textelement' style='z-index:"+this.zindex+";width:"+pb+"px;height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/librarypng/"+image+".png' id='elementimage"+this.elementid+"'  onload='myModule.changecolor("+this.elementid+")' ></div>").insertAfter($("#v3buttonlayer"));
997               this.left = myModule.width/2-this.width/2;
998               this.top=myModule.height/2-this.height/2;
999               this.top=myModule.height/2-this.height/2+top*myModule.width;
1000               this.left=myModule.width/2-this.width/2+left*myModule.width;
1001               var pl=myModule.left2pix(this.left);
1002               var pt=myModule.top2pix(this.top);
1003               $("#element"+this.elementid).css("left",pl);
1004               $("#element"+this.elementid).css("top",pt);
1005               if(this.colorname.substr(0,1)=="E") {
1006                    this.filesource="/teksten/"+image+".png";
1007               } else {
1008                    this.filesource="/librarypng/"+image+".png";
1009               }
1010
1011               this.setPropdiv();
1012               myModule.setCurrentProps();
1013               myModule.updateprops();
1014               this.visibleElement=$("#element"+thisElement.elementid);
1015               this.setTransparency();
1016               this.visibleElementPic=$("#elementimage"+thisElement.elementid);
1017               selectwindow.attachToElement(thisElement)
1018
1019               myModule.ensureZorder()
1020          }    
1021     }
1022     this.replaceLibItem=function replaceLibItem(libraryID,simpleShape,image,hwRatio,color,colorname,kisscuts,diecuts,minWidth,minHeight,useOutline,outlinecolor,outlinecolorname,outlinewidth) {
1023          this.libraryID=libraryID;
1024          this.image=image;
1025          this.hwRatio=hwRatio;
1026          this.hwRatioOriginal=hwRatio;
1027          this.hasColor=(simpleShape==1);
1028          this.colorname=colorname;
1029          this.color=color;
1030          this.kisscuts=kisscuts;
1031          this.diecuts=diecuts;
1032          this.minwidth=minWidth;
1033          this.minheight=minHeight;
1034          var lh=myModule.pxhoogte/2;
1035          var ph=lh;
1036          var pb=ph/hwRatio;
1037          useOutline=useOutline||0;
1038          outlinecolorname=outlinecolorname||"";
1039          outlinecolor=outlinecolor||"";
1040          outlinewidth=outlinewidth||0;
1041          this.useOutline=useOutline;
1042          this.outlinecolor=outlinecolor;
1043          this.oldOutlinecolor=outlinecolor;
1044          this.origOutlinecolor=outlinecolor;
1045          this.outlinecolorname=outlinecolorname;
1046          this.oldOutlinecolorname=outlinecolorname;
1047          this.origOutlinecolorname=outlinecolorname;
1048          this.outlinewidth=outlinewidth;
1049          this.height=this.width*hwRatio;
1050          if(myModule.designtype==3 || myModule.designtype==5) {
1051               $(".v3foilfield").each(function() {
1052                    if($(this).data("foilname")==thisElement.colorname) {
1053                         thisElement.foilwidth=$(this).children().first().data("maxdimension");
1054                    }
1055               })
1056          }
1057          if(useOutline==0 && this.colorname.substr(0,1)!="E") {
1058               var pl=myModule.left2pix(this.left);
1059               var pt=myModule.top2pix(this.top);
1060               $("#element"+this.elementid).css("left",pl);
1061               $("#element"+this.elementid).css("top",pt);
1062               if(this.colorname.substr(0,1)=="E") {
1063                    this.filesource="/teksten/"+image+".png";
1064               } else {
1065                    this.filesource="/librarypng/"+image+".png";
1066               }
1067
1068               myModule.setCurrentProps();
1069               myModule.updateprops();
1070               this.visibleElement=$("#element"+thisElement.elementid);
1071               this.setTransparency();
1072               this.visibleElementPic=$("#elementimage"+thisElement.elementid);
1073               $(this.visibleElementPic).prop("src",this.filesource);
1074               var newh=myModule.size2pix(this.height);
1075               this.visibleElement.css("height",newh+"px")
1076               selectwindow.attachToElement(thisElement)
1077               if(this.locked && this.zorder==2) {
1078                    this.visibleElement.css("pointer-events","none")
1079               }
1080
1081               if(this.hasColor) {
1082                    this.changeColor(this.color,this.colorname)
1083               }
1084               myModule.ensureZorder()
1085          } else {
1086			this.editClipart("");
1087          }
1088     }
1089
1090     this.addLibItem=function addLibItem(elementid,libraryID,simpleShape,image,hwRatio,color,colorname,kisscuts,diecuts,minWidth,minHeight,useOutline,outlinecolor,outlinecolorname,outlinewidth,copyfrom,multicopy) {
1091          copyfrom=copyfrom||0;
1092          multicopy=multicopy||0;
1093          this.elementid=elementid;
1094          this.zindex=elementid+10;
1095          this.elementtype=4;
1096          this.libraryID=libraryID;
1097          this.image=image;
1098          this.hwRatio=hwRatio;
1099          this.hwRatioOriginal=hwRatio;
1100          this.hasColor=(simpleShape==1);
1101          this.colorname=colorname;
1102          this.color=color;
1103          this.kisscuts=kisscuts;
1104          this.diecuts=diecuts;
1105          this.minwidth=minWidth;
1106          this.minheight=minHeight;
1107          var lh=myModule.pxhoogte/2;
1108          var ph=lh;
1109          var pb=ph/hwRatio;
1110          useOutline=useOutline||0;
1111          outlinecolorname=outlinecolorname||"";
1112          outlinecolor=outlinecolor||"";
1113          outlinewidth=outlinewidth||0;
1114          this.useOutline=useOutline;
1115          this.outlinecolor=outlinecolor;
1116          this.oldOutlinecolor=outlinecolor;
1117          this.origOutlinecolor=outlinecolor;
1118          this.outlinecolorname=outlinecolorname;
1119          this.oldOutlinecolorname=outlinecolorname;
1120          this.origOutlinecolorname=outlinecolorname;
1121          this.outlinewidth=outlinewidth;
1122          if(myModule.pix2size(pb)>myModule.width) {
1123               pb=myModule.size2pix(myModule.width)*0.8;
1124               ph=pb*hwRatio;
1125          }
1126          this.width=myModule.pix2size(pb);
1127          this.height=myModule.pix2size(ph);
1128          this.oWidth=this.width;
1129          this.oHeight=this.height;
1130          if(myModule.designtype==3 || myModule.designtype==5) {
1131               $(".v3foilfield").each(function() {
1132                    if($(this).data("foilname")==thisElement.colorname) {
1133                         thisElement.foilwidth=$(this).children().first().data("maxdimension");
1134                    }
1135               })
1136          }
1137          if(useOutline==0 && this.colorname.substr(0,1)!="E" && !this.effect.hasEffect()) {
1138               $("<div id='element"+this.elementid+"' class='v3element v3textelement' style='z-index:"+this.zindex+";width:"+pb+"px;height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/librarypng/"+image+".png' id='elementimage"+this.elementid+"'  onload='myModule.changecolor("+this.elementid+")' ></div>").insertAfter($("#v3buttonlayer"));
1139               this.left = myModule.width/2-this.width/2;
1140               this.top=myModule.height/2-this.height/2;
1141               var pl=myModule.left2pix(this.left);
1142               var pt=myModule.top2pix(this.top);
1143               $("#element"+this.elementid).css("left",pl);
1144               $("#element"+this.elementid).css("top",pt);
1145               if(this.colorname.substr(0,1)=="E") {
1146                    this.filesource="/teksten/"+image+".png";
1147               } else {
1148                    this.filesource="/librarypng/"+image+".png";
1149               }
1150
1151               this.setPropdiv();
1152               myModule.setCurrentProps();
1153               myModule.updateprops();
1154               this.visibleElement=$("#element"+thisElement.elementid);
1155               this.setTransparency();
1156               this.visibleElementPic=$("#elementimage"+thisElement.elementid);
1157               if(multicopy!=1){
1158               	selectwindow.attachToElement(thisElement)
1159               }
1160               if(this.locked && this.zorder==2) {
1161                    this.visibleElement.css("pointer-events","none")
1162               }
1163
1164               if(this.hasColor) {
1165                    //this.changeColor(this.color,this.colorname)
1166               }
1167               myModule.ensureZorder()
1168          } else {
1169
1170               xml="postdata=<root><clipartID>"+libraryID+"</clipartID>";
1171               xml+="<color>"+this.colorname+"</color>";
1172               xml+="<useoutline>"+this.useOutline+"</useoutline>";
1173               xml+="<outlinecolor>"+this.outlinecolorname+"</outlinecolor>";
1174               xml+="<outlinewidth>"+this.outlinewidth+"</outlinewidth>";
1175               xml+="<designtype>"+myModule.designtype+"</designtype>";
1176               xml+="<copyfrom>"+copyfrom+"</copyfrom>"
1177	          if(this.effect.hasEffect()) {
1178	               xml+="<haseffect>1</haseffect>";
1179	               xml+=this.effect.toXML();
1180	          } else {
1181	               xml+="<haseffect>0</haseffect>";
1182	          }
1183               xml+="</root>";
1184               $.ajax({
1185				type: "POST",
1186				dataType: "xml",
1187				Content_type:"text/html; charset=utf-8",
1188				data: xml,
1189				cache: false,
1190				url: "/123v3/clipart.php",
1191				success: function(xml) {
1192                         thisElement.startwaitloop(4,$(xml).find("clipartid").text());
1193                         thisElement.clipoutline=$(xml).find("clipartid").text();
1194                    }
1195               });
1196          }
1197     }
1198     this.openLibitemExisting=function openLibitemExisting(elementid,zindex,x,y,width,height,rotation,mirror,libraryID,simpleShape,image,hwRatio,color,colorname,kisscuts,diecuts,minwidth,minheight,marginleft,margintop,marginbottom,marginright,cropID,cropimg,croprotation) {
1199          this.elementid=elementid;
1200          this.zindex=elementid+10;
1201          this.elementtype=4;
1202          this.libraryID=libraryID;
1203          this.hasColor=(simpleShape==1);
1204          this.image=image
1205          this.hwRatio=hwRatio;
1206          if(hwRatio==0) {
1207               this.hwRatio=height/width;
1208          }
1209          this.hwRatioOriginal=hwRatio;
1210          this.colorname=colorname;
1211          this.color=color;
1212          this.kisscuts=kisscuts;
1213          this.diecuts=diecuts;
1214          this.minwidth=minwidth;
1215          this.minheight=minheight;
1216          this.margintop=margintop;
1217          this.marginright=marginright;
1218          this.marginbottom=marginbottom;
1219          this.marginleft=marginleft;
1220          this.left=x;
1221          this.top=y;
1222          this.width=width;
1223          this.height=height;
1224          this.rotation=rotation;
1225          this.mirror=mirror;
1226          this.usecurrentdimensions=1;
1227          this.cropID=cropID;
1228          this.cropimg=cropimg;
1229          this.cropRotation=croprotation;
1230          this.setPropdiv()
1231          xml="postdata=<root><clipartID>"+libraryID+"</clipartID>";
1232          xml+="<color>"+this.colorname+"</color>";
1233          xml+="<useoutline>"+this.useOutline+"</useoutline>";
1234          xml+="<outlinecolor>"+this.outlinecolorname+"</outlinecolor>";
1235          xml+="<outlinewidth>"+this.outlinewidth+"</outlinewidth>";
1236          xml+="<designtype>"+myModule.designtype+"</designtype>";
1237          xml+="<elementfillID>"+this.elementFillID+"</elementfillID>";
1238          xml+="</root>";
1239          $.ajax({
1240			type: "POST",
1241			dataType: "xml",
1242			Content_type:"text/html; charset=utf-8",
1243			data: xml,
1244			cache: false,
1245			url: "/123v3/clipart.php",
1246			success: function(xml) {
1247                    thisElement.startwaitloop(4,$(xml).find("clipartid").text());
1248                    thisElement.clipoutline=$(xml).find("clipartid").text();
1249               }
1250          });
1251     }
1252     this.openLibItem=function openLibItem(elementid,zindex,x,y,width,height,rotation,mirror,libraryID,simpleShape,image,hwRatio,color,colorname,kisscuts,diecuts,minwidth,minheight,marginleft,margintop,marginbottom,marginright,cropID,cropimg,croprotation) {
1253          this.elementid=elementid;
1254          this.zindex=elementid+10;
1255          this.elementtype=4;
1256          this.libraryID=libraryID;
1257          this.hasColor=(simpleShape==1);
1258          this.image=image;
1259          this.hwRatio=hwRatio;
1260          if(hwRatio==0) {
1261               this.hwRatio=height/width;
1262          }
1263          this.hwRatioOriginal=hwRatio;
1264          this.colorname=colorname;
1265          this.color=color;
1266          this.kisscuts=kisscuts;
1267          this.diecuts=diecuts;
1268          this.minwidth=minwidth;
1269          this.minheight=minheight;
1270          var lh=myModule.pxhoogte/2;
1271          var ph=myModule.size2pix(height);
1272          var pb=myModule.size2pix(width);
1273          this.margintop=margintop;
1274          this.marginright=marginright;
1275          this.marginbottom=marginbottom;
1276          this.marginleft=marginleft;
1277          this.width=width;
1278          this.height=height;
1279          this.rotation=rotation;
1280          this.mirror=mirror;
1281          this.cropID=cropID;
1282          this.cropimg=cropimg;
1283          this.cropRotation=croprotation;
1284          this.visibleElement=$("#element"+thisElement.elementid);
1285          this.setTransparency();
1286          this.visibleElementPic=$("#elementimage"+thisElement.elementid);
1287          if(cropID>0) {
1288               this.cropPicOpen();
1289          }
1290          //this.picWidth=this.width*(1+this.marginleft+this.marginright);
1291          //this.picHeight=this.height*(1+this.margintop+this.marginbottom);
1292
1293
1294          if(myModule.designtype==3 || myModule.designtype==5) {
1295               $(".v3foilfield").each(function() {
1296                    if($(this).data("foilname")==thisElement.colorname) {
1297                         thisElement.foilwidth=$(this).children().first().data("maxdimension");
1298                    }
1299               })
1300          }
1301          if(this.effect.hasCropEffect()) {
1302
1303               $("<div id='element"+this.elementid+"' class='v3element v3textelement' style='z-index:"+this.zindex+";width:"+pb+"px;height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/teksten/clip"+this.clipoutline+".png' id='elementimage"+this.elementid+"'></div>").insertAfter($("#v3buttonlayer"));
1304          } else {
1305               if(this.useOutline==1 || this.clipoutline>0) {
1306                    $("<div id='element"+this.elementid+"' class='v3element v3textelement' style='z-index:"+this.zindex+";width:"+pb+"px;height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/teksten/clip"+this.clipoutline+".png' id='elementimage"+this.elementid+"' onload='myModule.changecolor("+this.elementid+")'></div>").insertAfter($("#v3buttonlayer"));
1307               } else {
1308                    $("<div id='element"+this.elementid+"' class='v3element v3textelement' style='z-index:"+this.zindex+";width:"+pb+"px;height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/librarypng/"+image+"' id='elementimage"+this.elementid+"' onload='myModule.changecolor("+this.elementid+")'></div>").insertAfter($("#v3buttonlayer"));
1309               }
1310          }
1311          var pl=myModule.left2pix(x);
1312          var pt=myModule.top2pix(y);
1313          $("#element"+this.elementid).css("left",pl);
1314          $("#element"+this.elementid).css("top",pt);
1315          this.setTransform();
1316
1317          if(this.useOutline==1 || this.colorname.substr(0,1)=="E" ||this.effect.hasCropEffect()) {
1318               this.filesource="/teksten/clip"+this.clipoutline+".png";
1319          } else {
1320               this.filesource="/librarypng/"+image;
1321          }
1322          this.left=x;
1323          this.top=y;
1324          this.setPropdiv();
1325          myModule.setCurrentProps();
1326          myModule.updateprops();
1327          this.visibleElement=$("#element"+thisElement.elementid);
1328          this.setTransparency();
1329          this.visibleElementPic=$("#elementimage"+thisElement.elementid);
1330          //selectwindow.attachToElement(thisElement)
1331          if(this.locked && this.zorder==2) {
1332               this.visibleElement.css("pointer-events","none")
1333          }
1334
1335          if(this.hasColor) {
1336               //this.changeColor(this.color,this.colorname)
1337          }
1338          this.cropPicOpen();
1339          myModule.opencounter-=1;
1340          myModule.countOpen();
1341          if(this.isdroptarget==1) {
1342               this.setAsDroptarget();
1343          }
1344     }
1345
1346     this.openupload = function openupload(elementid,zindex,x,y,width,height,rotation,mirror,uploadid,image,oWidth,oHeight,v3Kisscuts,v3Diecuts,v3pixResX,v3pixResY,is123rf,id123rf,license123rf,credits123rf,marginTop,marginRight,marginBottom,marginLeft,hasColor,colorname,colorrgb,fileexists,cropID,cropimg,croprotation) {
1347          this.is123rf=is123rf;
1348          this.uploadID=uploadid;
1349          this.id123rf=id123rf;
1350          this.credits123rf=credits123rf;
1351          this.license123rf=license123rf;
1352          this.elementid=elementid;
1353          this.zindex=elementid+10;
1354          this.width=width;
1355          this.height=height;
1356          this.rotation=rotation;
1357          this.mirror=mirror;
1358          this.top=y;
1359          this.left=x;
1360          if(myModule.designtype==3 || myModule.designtype==5) {
1361               this.colorname=colorname;
1362               this.color=colorrgb;
1363               this.hasColor=1;
1364          }
1365          this.elementtype=3;
1366          this.image=image;
1367          this.filesource="/clientfiles/"+image;
1368          this.oWidth=oWidth;
1369          this.oHeight=oHeight;
1370          this.kisscuts=v3Kisscuts;
1371          this.diecuts=v3Diecuts;
1372          this.pixResX=v3pixResX;
1373          this.pixResY=v3pixResY;
1374          var hwratio=oHeight/oWidth;
1375          this.hwRatio=hwratio;
1376          this.hwRatioOriginal=hwratio;
1377          this.margintop=marginTop;
1378          this.marginright=marginRight;
1379          this.marginbottom=marginBottom;
1380          this.marginleft=marginLeft;
1381          this.cropID=cropID;
1382          this.cropimg=cropimg;
1383          this.cropRotation=croprotation;
1384          this.picWidth=this.width*(1+this.marginleft+this.marginright);
1385          this.picHeight=this.height*(1+this.margintop+this.marginbottom);
1386          var lh=myModule.pxhoogte/2;
1387          var ph=myModule.size2pix(height);
1388          var pb=myModule.size2pix(width);
1389          var folder = "/clientfiles/"
1390          if(fileexists=="0") {
1391               folder="/archive/"+this.clientpath+"/";
1392               this.isArchive=1;
1393          }
1394          if(myModule.designtype==3 || myModule.designtype==5) {
1395               $(".v3foilfield").each(function() {
1396                    if($(this).data("foilname")==thisElement.colorname) {
1397                         thisElement.foilwidth=$(this).children().first().data("maxdimension");
1398                    }
1399               })
1400          }
1401          $("<div id='element"+this.elementid+"' class='v3element v3textelement' style='z-index:"+this.zindex+";width:"+pb+"px;height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='"+folder+image+"' id='elementimage"+this.elementid+"'  onload='myModule.changecolor("+this.elementid+")' onerror='myModule.explainmissing(this)'></div>").insertAfter($("#v3buttonlayer"));
1402          var pl=myModule.left2pix(x);
1403          var pt=myModule.top2pix(y);
1404          $("#element"+this.elementid).css("left",pl);
1405          $("#element"+this.elementid).css("top",pt);
1406          this.setTransform();
1407          if(this.isArchive==1) {
1408               this.filesource="/archive/"+this.clientpath+"/"+image;
1409          } else {
1410               this.filesource="/clientfiles/"+image;
1411          }
1412          this.left=myModule.pix2left(pl);
1413          this.top=myModule.pix2top(pt);
1414          this.setPropdiv();
1415          //selectwindow.attachToElement(thisElement)
1416          myModule.setCurrentProps();
1417          myModule.updateprops();
1418          this.visibleElement=$("#element"+thisElement.elementid);
1419          this.setTransparency();
1420          this.visibleElementPic=$("#elementimage"+thisElement.elementid);
1421          this.cropPicOpen();
1422          if(this.isdroptarget==1) {
1423               this.setAsDroptarget();
1424          }
1425          myModule.opencounter-=1;
1426          myModule.countOpen();
1427          if(this.locked && this.zorder==2) {
1428               this.visibleElement.css("pointer-events","none")
1429          }
1430     }
1431     this.addUpload = function addUpload(elementid,uploadid,image,oWidth,oHeight,v3Kisscuts,v3Diecuts,v3pixResX,v3pixResY,color,colorname,isArchive,multicopy) {
1432          isArchive=isArchive||0;
1433          multicopy=multicopy||0;
1434          this.uploadID=uploadid;
1435          this.elementid=elementid;
1436          this.zindex=elementid+10;
1437          this.elementtype=3;
1438          this.image=image;
1439          if(isArchive==1) {
1440               this.filesource="/archive/"+myModule.archivepath+"/"+image;
1441          } else {
1442               this.filesource="/clientfiles/"+image;
1443          }
1444          if(myModule.designtype==3 || myModule.designtype==5) {
1445               this.hasColor=1;
1446               this.colorname=colorname;
1447               this.color=color;
1448          } else {
1449               this.hasColor=0;
1450          }
1451          this.oWidth=oWidth;
1452          this.oHeight=oHeight;
1453          this.kisscuts=v3Kisscuts;
1454          this.diecuts=v3Diecuts;
1455          this.pixResX=v3pixResX;
1456          this.pixResY=v3pixResY;
1457          var hwratio=oHeight/oWidth;
1458          this.hwRatio=hwratio;
1459          this.hwRatioOriginal=hwratio;
1460          if(myModule.designtype==3||myModule.designtype==5) {
1461               pb=myModule.size2pix(oWidth);
1462               ph=myModule.size2pix(oHeight);
1463               this.width=Number(oWidth);
1464               this.height=Number(oHeight);
1465          } else {
1466               if(myModule.pxhoogte/myModule.pxbreedte<oWidth/oHeight) {
1467                    var lh=myModule.pxhoogte+2*myModule.size2pix(myModule.bleed);
1468                    var ph=lh;
1469                    var pb=ph/hwratio;
1470               } else {
1471                    var lw=myModule.pxbreedte+2*myModule.size2pix(myModule.bleed);
1472                    pb=lw;
1473                    ph=pb*hwratio;
1474               }
1475                if(this.pixResX>0) {
1476                    var currentResX=this.pixResX * this.oWidth/myModule.pix2size(pb);
1477                    var goodres=myModule.greenlimit;
1478                    var maxdim=myModule.height;
1479                    if(Number(myModule.width)>maxdim) {
1480                         maxdim=myModule.width;
1481                    }
1482                    for (var q=0; q<bitmapquality.length; q++) {
1483                         if(bitmapquality[q][0]<=maxdim) {
1484                              goodres=bitmapquality[q][2];
1485                         }
1486                    }
1487
1488                    if(currentResX<goodres) {
1489                         pb*=currentResX/goodres*0.999;
1490                         ph*=currentResX/goodres*0.999;
1491                    }
1492               }
1493               if(myModule.designtype==6) {
1494                    this.width=myModule.pix2size(pb)*0.9;
1495                    this.height=myModule.pix2size(ph)*0.9;
1496               } else {
1497                    this.width=myModule.pix2size(pb);
1498                    this.height=myModule.pix2size(ph);
1499               }
1500               if(this.width/oWidth>0.95 && this.width/oWidth<1.1) {
1501                    this.width=Number(oWidth);
1502                    this.height=Number(oHeight);
1503                    pb=myModule.size2pix(oWidth);
1504                    ph=myModule.size2pix(oHeight);
1505               }
1506          }
1507          if(myModule.designtype==3 || myModule.designtype==5) {
1508               $(".v3foilfield").each(function() {
1509                    if($(this).data("foilname")==thisElement.colorname) {
1510                         thisElement.foilwidth=$(this).children().first().data("maxdimension");
1511                    }
1512               })
1513          }
1514		var d=new Date();
1515		d=d.getTime()   
1516		d="?"+d       
1517		if(myModule.designtype==3 || myModule.designtype==5) {
1518	          if(isArchive==1) {
1519	               $("<div id='element"+this.elementid+"' class='v3element v3textelement' style='z-index:"+this.zindex+";width:"+pb+"px;height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/archive/"+myModule.archivepath+"/"+image+".png"+d+"' id='elementimage"+this.elementid+"' onload='myModule.changecolor("+this.elementid+")'></div>").insertAfter($("#v3buttonlayer"));
1520	          } else {
1521	               $("<div id='element"+this.elementid+"' class='v3element v3textelement' style='z-index:"+this.zindex+";width:"+pb+"px;height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/clientfiles/"+image+".png"+d+"' id='elementimage"+this.elementid+"' onload='myModule.changecolor("+this.elementid+")' ></div>").insertAfter($("#v3buttonlayer"));
1522	          }
1523		}else{
1524	          if(isArchive==1) {
1525	               $("<div id='element"+this.elementid+"' class='v3element v3textelement' style='z-index:"+this.zindex+";width:"+pb+"px;height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/archive/"+myModule.archivepath+"/"+image+".png"+d+"' id='elementimage"+this.elementid+"'></div>").insertAfter($("#v3buttonlayer"));
1526	          } else {
1527	               $("<div id='element"+this.elementid+"' class='v3element v3textelement' style='z-index:"+this.zindex+";width:"+pb+"px;height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/clientfiles/"+image+".png"+d+"' id='elementimage"+this.elementid+"'></div>").insertAfter($("#v3buttonlayer"));
1528	          }
1529	     }
1530          this.left = myModule.width/2-this.width/2;
1531          this.top=myModule.height/2-this.height/2;
1532          var pl=myModule.left2pix(this.left);
1533          var pt=myModule.top2pix(this.top);
1534          $("#element"+this.elementid).css("left",pl);
1535          $("#element"+this.elementid).css("top",pt);
1536          if(isArchive==1) {
1537               this.filesource="/archive/"+myModule.archivepath+"/"+image+".png";
1538          } else {
1539               this.filesource="/clientfiles/"+image+".png";
1540          }
1541          this.setPropdiv();
1542          this.visibleElement=$("#element"+thisElement.elementid);
1543          this.setTransparency();
1544          this.visibleElementPic=$("#elementimage"+thisElement.elementid);
1545          if(this.hasColor) {
1546          }
1547          if(this.locked && this.zorder==2) {
1548               this.visibleElement.css("pointer-events","none")
1549          }
1550          if(multicopy!=1){
1551          	selectwindow.attachToElement(thisElement);
1552          	if(myModule.editimmediately==1){
1553          		myModule.editimmediately=0;
1554          		myModule.editPicContent();
1555          	}
1556          }
1557
1558     }
1559     this.addUploadBackground = function addUploadBackground(elementid,uploadid,image,v3Kisscuts,v3Diecuts,v3pixResX,v3pixResY,bgwidth,bgheight,bgleft,bgtop,isArchive) {
1560          isArchive=isArchive||0;
1561          this.isArchive=isArchive;
1562          this.uploadID=uploadid;
1563          this.elementid=elementid;
1564          this.zindex=elementid+10;
1565          this.elementtype=3;
1566          this.image=image;
1567          this.filesource="/clientfiles/"+image;
1568          this.hasColor=0;
1569          this.kisscuts=v3Kisscuts;
1570          this.diecuts=v3Diecuts;
1571          this.pixResX=v3pixResX;
1572          this.pixResY=v3pixResY;
1573          this.width=(Number(myModule.width)+Number(myModule.bleed))*bgwidth;
1574          this.height=(Number(myModule.width)+Number(myModule.bleed))*bgheight
1575          this.top=myModule.height/2-this.height/2+bgtop*myModule.width;
1576          this.left=myModule.width/2-this.width/2+bgleft*myModule.width;
1577          var pb=myModule.size2pix(this.width);
1578          var ph=myModule.size2pix(this.height);
1579          this.oWidth=this.width;
1580          this.oHeight=this.height;
1581          var hwratio=this.width/this.height;
1582          this.hwRatio=hwratio;
1583          this.hwRatioOriginal=hwratio;
1584          if(this.pixResX>
15840) {
1585               var currentResX=this.pixResX * this.width/myModule.pix2size(pb);
1586               var goodres=myModule.greenlimit;
1587               var maxdim=myModule.height;
1588               if(Number(myModule.width)>maxdim) {
1589                    maxdim=myModule.width;
1590               }
1591               for (var q=0; q<bitmapquality.length; q++) {
1592                    if(bitmapquality[q][0]<=maxdim) {
1593                         goodres=bitmapquality[q][2];
1594                    }
1595               }
1596
1597               if(currentResX<goodres) {
1598                    pb*=currentResX/goodres*0.999;
1599                    ph*=currentResX/goodres*0.999;
1600               }
1601          }
1602		var d=new Date();
1603		d=d.getTime()   
1604		d="?"+d  
1605		if(isArchive==1){
1606	     	$("<div id='element"+this.elementid+"' class='v3element v3textelement' style='z-index:"+this.zindex+";width:"+pb+"px;height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/archive/clientfiles/"+image+".png"+d+"' id='elementimage"+this.elementid+"'></div>").insertAfter($("#v3buttonlayer"));
1607		}else{ 
1608	     	$("<div id='element"+this.elementid+"' class='v3element v3textelement' style='z-index:"+this.zindex+";width:"+pb+"px;height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/clientfiles/"+image+".png"+d+"' id='elementimage"+this.elementid+"'></div>").insertAfter($("#v3buttonlayer"));
1609	     }
1610          var pl=myModule.left2pix(this.left);
1611          var pt=myModule.top2pix(this.top);
1612          $("#element"+this.elementid).css("left",pl);
1613          $("#element"+this.elementid).css("top",pt);
1614          if(isArchive==1){
1615          	this.filesource="/archive/"+myModule.archivepath+"/"+image+".png";
1616          }else{
1617          	this.filesource="/clientfiles/"+image+".png";
1618          }
1619          this.setPropdiv();
1620          this.visibleElement=$("#element"+thisElement.elementid);
1621          this.setTransparency();
1622          this.visibleElementPic=$("#elementimage"+thisElement.elementid);
1623          if(this.locked && this.zorder==2) {
1624               this.visibleElement.css("pointer-events","none")
1625          }
1626          selectwindow.attachToElement(thisElement)
1627
1628     }
1629     this.add123rf = function add123rf(elementid,uploadid,image,oWidth,oHeight,v3Kisscuts,v3Diecuts,v3pixResX,v3pixResY,id123rf,license123rf,credits123rf) {
1630          this.is123rf=1;
1631          this.uploadID=uploadid;
1632          this.id123rf=id123rf;
1633          this.credits123rf=credits123rf;
1634          this.license123rf=license123rf;
1635          this.elementid=elementid;
1636          this.zindex=elementid+10;
1637          this.elementtype=3;
1638          this.image=image;
1639          this.filesource="/clientfiles/"+image;
1640          this.oWidth=oWidth;
1641          this.oHeight=oHeight;
1642          this.kisscuts=v3Kisscuts;
1643          this.diecuts=v3Diecuts;
1644          this.pixResX=v3pixResX;
1645          this.pixResY=v3pixResY;
1646          var hwratio=oHeight/oWidth;
1647          this.hwRatio=hwratio;
1648          this.hwRatioOriginal=hwratio;
1649          var lh=myModule.pxhoogte/2;
1650          var ph=lh;
1651          var pb=ph/hwratio;
1652          this.width=myModule.pix2size(pb);
1653          this.height=myModule.pix2size(ph);
1654          $("<div id='element"+this.elementid+"' class='v3element v3textelement' style='z-index:"+this.zindex+";width:"+pb+"px;height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/clientfiles/"+image+".png' id='elementimage"+this.elementid+"' ></div>").insertAfter($("#v3buttonlayer"));
1655          var pl=myModule.leftOffset+myModule.offsetx+(myModule.pxbreedte-pb)/2;
1656          var pt=myModule.topOffset+myModule.offsety+(myModule.pxhoogte-ph)/2;
1657          $("#element"+this.elementid).css("left",pl);
1658          $("#element"+this.elementid).css("top",pt);
1659          this.filesource="/clientfiles/"+image+".png";
1660          this.left=myModule.pix2left(pl);
1661          this.top=myModule.pix2top(pt);
1662          this.setPropdiv();
1663          myModule.setCurrentProps();
1664          myModule.updateprops();
1665          this.visibleElement=$("#element"+thisElement.elementid);
1666          this.setTransparency();
1667          this.visibleElementPic=$("#elementimage"+thisElement.elementid);
1668          selectwindow.attachToElement(thisElement)
1669
1670     }
1671     this.startwaitloop=function startwaitloop(elementType,elementID) {
1672          if(elementType==10) {
1673               thisElement.elementtype=4;
1674          } else {
1675               thisElement.elementtype=elementType;
1676          }
1677          thisElement.timerID=elementID;
1678          if(thisElement.timerVar>0){
1679          	clearInterval(thisElement.timerVar)
1680          }
1681          if(elementType==1) {
1682               thisElement.timerVar=setInterval(myTimer,500);
1683          }
1684          if(elementType==2) {
1685               thisElement.timerVar=setInterval(myTimer,500);
1686          }
1687          if(elementType==3) {
1688               thisElement.timerVar=setInterval(thisElement.myCropTimer,500);
1689          }
1690          if(elementType==4) {
1691               thisElement.timerVar=setInterval(myClipTimer,500);
1692          }
1693          if(elementType==5) {
1694               thisElement.timerVar=setInterval(myQrTimer,500);
1695          }
1696          if(elementType==10) {
1697               thisElement.timerVar=setInterval(myclipcropTimer,500);
1698          }
1699     }
1700
1701     function myTimer() {
1702          xml='postdata=<root><elementType>'+thisElement.elementtype+'</elementType><id>'+thisElement.timerID+'</id></root>';
1703          var tmv=thisElement.timerVar;
1704          var elementType=thisElement.elementtype;
1705          $.ajax({
1706			type: "POST",
1707			dataType: "xml",
1708			data: xml,
1709			cache: false,
1710			url: "/123v3/elementready.php",
1711			success: function(xml) {
1712                    if($(xml).find("state").text()==1) {
1713                         clearInterval(tmv);
1714                         thisElement.timerVar=0;
1715                         if(elementType==1) {
1716                              var textid=$(xml).find("id").text();
1717
1718                              thisElement.placeNewShape(textid);
1719                         }
1720
1721                         if(elementType==2) {
1722                              var hwratio=$(xml).find("hwratio").text()
1723                              var tlratio=$(xml).find("textletterratio").text()
1724                              var textid=$(xml).find("id").text();
1725                              var usesvg=$(xml).find("usesvg").text();
1726                              var curvewidthratio=$(xml).find("curvewidthratio").text();
1727                              thisElement.placeNewText(hwratio,tlratio,textid,usesvg,curvewidthratio);
1728
1729                         }
1730                    }
1731                    if($(xml).find("state").text()==2) {
1732                         clearInterval(tmv);
1733                         thisElement.timerVar=0;
1734                         myModule.opencounter-=1;
1735                         myModule.countOpen();
1736                         thisElement.removeElement();
1737                    }
1738               }
1739          });
1740     }
1741     function myQrTimer() {
1742          xml='postdata=<root><elementType>'+thisElement.elementtype+'</elementType><id>'+thisElement.timerID+'</id></root>';
1743          var tmv=thisElement.timerVar;
1744          var elementType=thisElement.elementtype;
1745
1746          $.ajax({
1747			type: "POST",
1748			dataType: "xml",
1749			data: xml,
1750			cache: false,
1751			url: "/123v3/elementready.php",
1752			success: function(xml) {
1753                    if($(xml).find("state").text()==1) {
1754                         clearInterval(tmv);
1755                         thisElement.timerVar=0;
1756                         if(elementType==5) {
1757                              var textid=$(xml).find("id").text();
1758                              var hwratio=$(xml).find("heightwidthratio").text();
1759                              placeNewQr(textid,hwratio);
1760                         }
1761                    }
1762                    if($(xml).find("state").text()==2) {
1763                         clearInterval(tmv);
1764                         thisElement.timerVar=0;
1765                    }
1766               }
1767          });
1768     }
1769     this.myCropTimer=function myCropTimer() {
1770          xml='postdata=<root><elementType>9</elementType><id>'+thisElement.timerID+'</id></root>';
1771          var tmv=thisElement.timerVar;
1772          var elementType=thisElement.elementtype;
1773
1774          $.ajax({
1775			type: "POST",
1776			dataType: "xml",
1777			data: xml,
1778			cache: false,
1779			url: "/123v3/elementready.php",
1780			success: function(xml) {
1781                    if($(xml).find("result").text()==1) {
1782                         clearInterval(tmv);
1783                         thisElement.timerVar=0;
1784                         var eff=$(xml).find("effectratios");
1785                         var origwidth=thisElement.width/thisElement.effect.widthratio;
1786                         var origheight=thisElement.height/thisElement.effect.heightratio;
1787                         var origpicWidth=thisElement.picWidth/thisElement.effect.widthratio;
1788                         var origpicHeight=thisElement.picHeight/thisElement.effect.heightratio;
1789                         if($(eff).find("width").text()!="") {
1790                              thisElement.effect.widthratio=$(eff).find("width").text();
1791                              thisElement.effect.heightratio=$(eff).find("height").text();
1792                              thisElement.picWidth=origpicWidth*Number($(eff).find("width").text());
1793                              thisElement.picHeight=origpicHeight*Number($(eff).find("height").text());
1794                         } else {
1795                              thisElement.effect.widthratio=1;
1796                              thisElement.effect.heightratio=1;
1797                              thisElement.picWidth=origpicWidth;
1798                              thisElement.picHeight=origpicHeight;
1799                         }
1800                         thisElement.cropimg = $(xml).find("imgfile").text();
1801                         thisElement.cropPic()
1802                    }
1803                    if($(xml).find("result").text()==2) {
1804                         clearInterval(tmv);
1805                         thisElement.timerVar=0;
1806                    }
1807               }
1808          });
1809     }
1810     function myclipcropTimer() {
1811          xml='postdata=<root><elementType>10</elementType><id>'+thisElement.timerID+'</id></root>';
1812          var tmv=thisElement.timerVar;
1813          var elementType=4;
1814
1815          $.ajax({
1816			type: "POST",
1817			dataType: "xml",
1818			data: xml,
1819			cache: false,
1820			url: "/123v3/elementready.php",
1821			success: function(xml) {
1822                    if($(xml).find("result").text()==1) {
1823                         clearInterval(tmv);
1824                         thisElement.timerVar=0;
1825                         thisElement.cropimg = $(xml).find("imgfile").text();
1826                         thisElement.cropPic()
1827                    }
1828                    if($(xml).find("result").text()==2) {
1829                         clearInterval(tmv);
1830                         thisElement.timerVar=0;
1831                    }
1832               }
1833          });
1834     }
1835
1836     function myClipTimer() {
1837          xml='postdata=<root><elementType>4</elementType><id>'+thisElement.timerID+'</id></root>';
1838          var tmv=thisElement.timerVar;
1839          var elementType=thisElement.elementtype;
1840
1841          $.ajax({
1842			type: "POST",
1843			dataType: "xml",
1844			data: xml,
1845			cache: false,
1846			url: "/123v3/elementready.php",
1847			success: function(xml) {
1848                    if($(xml).find("state").text()==1) {
1849                         clearInterval(tmv);
1850                         thisElement.timerVar=0;
1851                         if(elementType==4) {
1852                              var textid=$(xml).find("id").text();
1853                              var hwratio=$(xml).find("heightwidthratio").text();
1854                              thisElement.placeNewClip(textid,hwratio);
1855                         }
1856                    }
1857                    if($(xml).find("result").text()==2) {
1858                         clearInterval(tmv);
1859                         thisElement.timerVar=0;
1860                    }
1861               }
1862          });
1863     }
1864     function placeNewQr(id,hwratio) {
1865          myModule.hideDialog();
1866          thisElement.qrid=id;
1867          thisElement.filesource="qr"+id+".png";
1868          thisElement.hwRatio=hwratio;
1869          thisElement.hwRatioOriginal=hwratio;
1870          var lh=0;
1871          var lb=0;
1872          if(thisElement.usecurrentdimensions==1) {
1873               lh=myModule.size2pix(thisElement.height);
1874               lb=myModule.size2pix(thisElement.width);
1875          } else {
1876               if(thisElement.barcodetype==0) {
1877                    lh=myModule.pxhoogte/2;
1878                    lb=lh;
1879                    thisElement.width=myModule.pix2size(lb);
1880                    thisElement.height=myModule.pix2size(lh);
1881               } else {
1882                    lh=myModule.pxhoogte/4;
1883                    lb=lh/hwratio;
1884                    thisElement.width=myModule.pix2size(lb);
1885                    thisElement.height=myModule.pix2size(lh);
1886
1887               }
1888          }
1889          $("<div id='element"+thisElement.elementid+"' class='v3element v3textelement' style='z-index:"+thisElement.zindex+";width:"+lb+"px;height:"+lh+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3qrclass' src='/clientfiles/qr"+id+".png' id='elementimage"+thisElement.elementid+"' onload='myModule.changecolor("+thisElement.elementid+")'></div>").insertAfter($("#v3buttonlayer"));
1890          var pl=0;
1891          var pt=0;
1892          var rot=0;
1893          if(thisElement.usecurrentdimensions==1) {
1894               pl=myModule.left2pix(thisElement.left);
1895               pt=myModule.top2pix(thisElement.top);
1896               rot=thisElement.rotation;
1897               //thisElement.filesource="/clientfiles/qr"+id+".png";
1898          } else {
1899               thisElement.left = myModule.width/2-thisElement.width/2;
1900               thisElement.top=myModule.height/2-thisElement.height/2;
1901               var pl=myModule.left2pix(thisElement.left);
1902               var pt=myModule.top2pix(thisElement.top);
1903               //thisElement.filesource="/clientfiles/qr"+id+".png";
1904          }
1905          $("#element"+thisElement.elementid).css("left",pl);
1906          $("#element"+thisElement.elementid).css("top",pt);
1907          thisElement.setTransform();
1908          if(thisElement.usecurrentdimensions!=1) {
1909               thisElement.setPropdiv();
1910          } else {
1911               myModule.currentElement=thisElement;
1912               myModule.opencounter-=1;
1913               myModule.countOpen();
1914          }
1915          myModule.setCurrentProps();
1916          myModule.updateprops();
1917          thisElement.visibleElement=$("#element"+thisElement.elementid);
1918          thisElement.setTransparency();
1919          if(thisElement.openexisting==1) {
1920               thisElement.openexisting=0;
1921          } else {
1922               selectwindow.attachToElement(thisElement)
1923          }
1924          myModule.ensureZorder()
1925          if(myModule.designtype==3) {
1926               myModule.checkFoilDeleted()
1927          }
1928     }
1929     this.placeNewClip=function placeNewClip(id,hwratio) {
1930
1931          myModule.hideDialog();
1932          thisElement.qrid=id;
1933          thisElement.filesource="/teksten/clip"+id+".png"
1934                                 thisElement.hwRatio=hwratio;
1935          thisElement.hwRatioOriginal=hwratio
1936                                      var lh=0;
1937          var lb=0;
1938          if(thisElement.usecurrentdimensions==1) {
1939               lh=myModule.size2pix(thisElement.height);
1940               lb=myModule.size2pix(thisElement.width);
1941          } else {
1942               lh=myModule.pxhoogte/4;
1943               lb=lh/hwratio;
1944               thisElement.width=myModule.pix2size(lb);
1945               thisElement.height=myModule.pix2size(lh);
1946          }
1947          if(thisElement.effect.hasCropEffect()) {
1948               $("<div id='element"+thisElement.elementid+"' class='v3element v3textelement' style='z-index:"+thisElement.zindex+";width:"+lb+"px;height:"+lh+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3qrclass' src='/teksten/clip"+id+".png' id='elementimage"+thisElement.elementid+"' ></div>").insertAfter($("#v3buttonlayer"));
1949          } else {
1950               $("<div id='element"+thisElement.elementid+"' class='v3element v3textelement' style='z-index:"+thisElement.zindex+";width:"+lb+"px;height:"+lh+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3qrclass' src='/teksten/clip"+id+".png' id='elementimage"+thisElement.elementid+"'  onload='myModule.changecolor("+thisElement.elementid+")' ></div>").insertAfter($("#v3buttonlayer"));
1951          }
1952          var pl=0;
1953          var pt=0;
1954          var rot=0;
1955          if(thisElement.usecurrentdimensions==1) {
1956               pl=myModule.left2pix(thisElement.left);
1957               pt=myModule.top2pix(thisElement.top);
1958               rot=thisElement.rotation;
1959               thisElement.filesource="/teksten/clip"+id+".png";
1960          } else {
1961               thisElement.left = myModule.width/2-thisElement.width/2;
1962               thisElement.top=myModule.height/2-thisElement.height/2;
1963               var pl=myModule.left2pix(thisElement.left);
1964               var pt=myModule.top2pix(thisElement.top);
1965               thisElement.filesource="/teksten/clip"+id+".png";
1966          }
1967          $("#element"+thisElement.elementid).css("left",pl);
1968          $("#element"+thisElement.elementid).css("top",pt);
1969          thisElement.setTransform();
1970          if(thisElement.usecurrentdimensions!=1) {
1971               thisElement.setPropdiv();
1972          } else {
1973               myModule.currentElement=thisElement;
1974               myModule.opencounter-=1;
1975               myModule.countOpen();
1976          }
1977          myModule.setCurrentProps();
1978          myModule.updateprops();
1979          thisElement.visibleElement=$("#element"+thisElement.elementid);
1980          if(thisElement.openexisting==1) {
1981               thisElement.openexisting=0;
1982          } else {
1983               selectwindow.attachToElement(thisElement)
1984          }
1985          thisElement.visibleElement=$("#element"+thisElement.elementid);
1986          thisElement.setTransparency();
1987          thisElement.visibleElementPic=$("#elementimage"+thisElement.elementid);
1988          myModule.ensureZorder()
1989          //setTimeout(colorQr,200);
1990     }
1991     this.placeNewShape=function placeNewShape(textid) {
1992          myModule.hideDialog();
1993          thisElement.shapeid=textid;
1994          var lh=0;
1995          var ph=0;
1996          var pb=0;
1997          var rot=0;
1998          pb=myModule.size2pix(thisElement.width);
1999          ph=myModule.size2pix(thisElement.height);
2000          if(thisElement.effect.hasCropEffect()) {
2001               $("<div id='element"+thisElement.elementid+"' class='v3element v3textelement' style='z-index:"+thisElement.zindex+";width:"+pb+"px;
2001height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/teksten/shape"+textid+".png' id='elementimage"+thisElement.elementid+"'></div>").insertAfter($("#v3buttonlayer"));
2002          } else {
2003               $("<div id='element"+thisElement.elementid+"' class='v3element v3textelement' style='z-index:"+thisElement.zindex+";width:"+pb+"px;height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/teksten/shape"+textid+".png' id='elementimage"+thisElement.elementid+"' onload='myModule.changecolor("+thisElement.elementid+")'></div>").insertAfter($("#v3buttonlayer"));
2004          }
2005          var pl=myModule.left2pix(myModule.width/2-thisElement.width/2);
2006          var pt=myModule.top2pix(myModule.height/2-thisElement.height/2);
2007          if(thisElement.usecurrentdimensions==1) {
2008               pl=myModule.left2pix(thisElement.left)
2009                  pt=myModule.top2pix(thisElement.top)
2010          }
2011          $("#element"+thisElement.elementid).css("left",pl);
2012          $("#element"+thisElement.elementid).css("top",pt);
2013          thisElement.setTransform();
2014          thisElement.filesource="/teksten/shape"+textid+".png";
2015          if(thisElement.usecurrentdimensions!=1) {
2016               thisElement.left=myModule.pix2left(pl);
2017               thisElement.top=myModule.pix2top(pt);
2018               thisElement.setPropdiv();
2019          } else {
2020               myModule.currentElement=thisElement;
2021               myModule.opencounter-=1;
2022               myModule.countOpen();
2023
2024          }
2025          if(myModule.duplicateChange>0) {
2026               myModule.currentChange=myModule.duplicateChange;
2027               myModule.duplicateChange=0;
2028          }
2029          myModule.setCurrentProps();
2030          myModule.updateprops();
2031          thisElement.visibleElement=$("#element"+thisElement.elementid);
2032          if(this.isdroptarget==1) {
2033               this.setAsDroptarget();
2034          }
2035          thisElement.setTransparency();
2036          if(thisElement.openexisting==1) {
2037               thisElement.openexisting=0;
2038          } else {
2039               selectwindow.attachToElement(thisElement)
2040          }
2041          if(myModule.designtype==3 || myModule.designtype==5) {
2042               setTimeout(myModule.forceRedrawlettering,200);
2043          }
2044          myModule.ensureZorder()
2045          if(myModule.openOldKenteken==1) {
2046               myModule.openOldKenteken=0;
2047               myModule.saveTmp=1;
2048               myModule.changeElementHeight(myModule.height/10);
2049               if(thisElement.width>myModule.width) {
2050                    myModule.changeElementWidth(myModule.width/10);
2051               }
2052          }
2053          if(myModule.designtype==3) {
2054               myModule.checkFoilDeleted()
2055          }
2056     }
2057     this.placeNewText=function placeNewText(hwratio,tlratio,textid,usesvg,curvewidthratio) {
2058          thisElement.textid=textid;
2059          thisElement.hwRatio=hwratio;
2060          thisElement.hwRatioOriginal=hwratio;
2061          thisElement.usesvg=usesvg;
2062          thisElement.curvewidthratio=curvewidthratio
2063          var lh=0;
2064          var ph=0;
2065          var pb=0;
2066          var rot=0;
2067          if(thisElement.usecurrentdimensions==1) {
2068               thisElement.tlRatio=tlratio;
2069               thisElement.letterheight=thisElement.height/thisElement.tlRatio
2070               ph=myModule.size2pix(thisElement.height);
2071               pb=myModule.size2pix(thisElement.width);
2072               rot=thisElement.rotation;
2073          } else {
2074               thisElement.tlRatio=tlratio;
2075               lh=thisElement.letterheight/myModule.height*myModule.pxhoogte;
2076               ph=lh*tlratio;
2077               pb=ph/hwratio;
2078               thisElement.width=myModule.pix2size(pb);
2079               thisElement.height=myModule.pix2size(ph);
2080               if(thisElement.width>myModule.width*0.9) {
2081                    //if(myModule.currentLetterheight==0) {
2082                         thisElement.width=myModule.width*0.9;
2083                         thisElement.height=thisElement.width*thisElement.hwRatio;
2084                         thisElement.letterheight=thisElement.height/thisElement.tlRatio;
2085                         pb=myModule.size2pix(thisElement.width);
2086                         ph=myModule.size2pix(thisElement.height);
2087                    //}
2088               }
2089          }
2090          myModule.currentLetterheight=thisElement.letterheight;
2091          myModule.currentFontMinimum=this.fontminimum;
2092          if(thisElement.usesvg==1) {
2093               $("<object id='element"+thisElement.elementid+"' class='v3element v3textelement' style='overflow:visible;z-index:"+thisElement.zindex+";width:"+pb+"px;
2093height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass'  id='elementimage"+thisElement.elementid+"' onload='myModule.changecolor("+thisElement.elementid+")'></object>").insertAfter($("#v3buttonlayer"));
2094               $("#element"+thisElement.elementid).load('/teksten/'+textid+'.svg',function() {
2095                    myModule.changecolor(thisElement.elementid)
2096               })
2097          } else {
2098               if(thisElement.effect.hasCropEffect()) {
2099                    $("<div id='element"+thisElement.elementid+"' class='v3element v3textelement' style='overflow:visible;z-index:"+thisElement.zindex+";width:"+pb+"px;height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/teksten/"+textid+".png' id='elementimage"+thisElement.elementid+"'></div>").insertAfter($("#v3buttonlayer"));
2100               } else {
2101                    $("<div id='element"+thisElement.elementid+"' class='v3element v3textelement' style='overflow:visible;z-index:"+thisElement.zindex+";width:"+pb+"px;height:"+ph+"px' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='/teksten/"+textid+".png' id='elementimage"+thisElement.elementid+"' onload='myModule.changecolor("+thisElement.elementid+")'></div>").insertAfter($("#v3buttonlayer"));
2102               }
2103          }
2104          var pl=myModule.left2pix(myModule.width/2-thisElement.width/2);
2105          var pt=myModule.top2pix(myModule.height/2-thisElement.height/2);
2106          if(thisElement.usecurrentdimensions==1) {
2107               pl=myModule.left2pix(thisElement.left)
2108               pt=myModule.top2pix(thisElement.top)
2109          }
2110
2111          $("#element"+thisElement.elementid).css("left",pl);
2112          $("#element"+thisElement.elementid).css("top",pt);
2113          thisElement.setTransform();
2114          if(this.usesvg==1) {
2115               thisElement.filesource="/teksten/"+textid+".svg";
2116          } else {
2117               thisElement.filesource="/teksten/"+textid+".png";
2118          }
2119          if(thisElement.usecurrentdimensions!=1) {
2120               thisElement.left=myModule.pix2left(pl);
2121               thisElement.top=myModule.pix2top(pt);
2122               thisElement.setPropdiv();
2123          } else {
2124               myModule.currentElement=thisElement;
2125               myModule.opencounter-=1;
2126               myModule.countOpen();
2127          }
2128          myModule.setCurrentProps();
2129          myModule.updateprops();
2130          thisElement.visibleElement=$("#element"+thisElement.elementid);
2131          thisElement.setTransparency();
2132          if(thisElement.openexisting==1) {
2133               thisElement.openexisting=0;
2134          } else {
2135               selectwindow.attachToElement(thisElement)
2136
2137          }
2138          if(myModule.designtype==3 || myModule.designtype==5) {
2139               setTimeout(myModule.forceRedrawlettering,200);
2140          }
2141          myModule.ensureZorder()
2142          if(myModule.openOldKenteken==1) {
2143               myModule.openOldKenteken=0;
2144               myModule.saveTmp=1;
2145               myModule.changeElementHeight(myModule.height/10);
2146               if(thisElement.width>myModule.width) {
2147                    myModule.changeElementWidth(myModule.width/10);
2148               }
2149          }
2150          if(myModule.designtype==3) {
2151               myModule.checkFoilDeleted()
2152          }
2153          if(typeof(circleflag)!="undefined") {
2154               if(circleflag===1) {
2155                    showrealcircle();
2156                    $("#v3dialogsmall").hide();
2157               } else {
2158                    myModule.hideDialog();
2159               }
2160          } else {
2161               myModule.hideDialog();
2162          }
2163     }
2164     this.placepatterntext=function placepatterntext(){
2165     	
2166     	var pb=myModule.size2pix(thisElement.width);
2167     	var ph=myModule.size2pix(thisElement.height);
2168     	var pl=myModule.left2pix(thisElement.left);
2169     	var pt=myModule.top2pix(thisElement.top);
2170          $("<object id='element"+thisElement.elementid+"' class='v3element v3textelement' style='overflow:visible;z-index:"+thisElement.zindex+";width:"+pb+"px;
2170height:"+ph+"px;left:"+pl+"px;top:"+pt+"px;transform:rotate("+thisElement.rotation+"deg)' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass'  id='elementimage"+thisElement.elementid+"' onload='myModule.changecolor("+thisElement.elementid+")'></object>").insertAfter($("#v3buttonlayer"));
2171          $("#element"+thisElement.elementid).load('/teksten/'+thisElement.textid+'.svg',function() {
2172               myModule.changecolor(thisElement.elementid)
2173          })
2174		thisElement.visibleElement=$("#element"+thisElement.elementid);
2175		thisElement.setPropdiv();
2176          myModule.setCurrentProps();
2177          //myModule.updateprops(); uit laten staan: dit geeft iedere keer een savedesign
2178
2179     }
2180     this.placepatternlib=function placepatternlib(){
2181     	
2182     	var pb=myModule.size2pix(thisElement.width);
2183     	var ph=myModule.size2pix(thisElement.height);
2184     	var pl=myModule.left2pix(thisElement.left);
2185     	var pt=myModule.top2pix(thisElement.top);
2186          $("<div id='element"+this.elementid+"' class='v3element v3textelement' style='z-index:"+this.zindex+";width:"+pb+"px;height:"+ph+"px;left:"+pl+"px;top:"+pt+"px;transform:rotate("+thisElement.rotation+"deg)' onclick='myModule.clickElement(event,this)'><img draggable='false' class='v3textclass' src='"+thisElement.filesource+"' id='elementimage"+this.elementid+"'  onload='myModule.changecolor("+this.elementid+")' ></div>").insertAfter($("#v3buttonlayer"));
2187		thisElement.visibleElement=$("#element"+thisElement.elementid);
2188		thisElement.setPropdiv();
2189          myModule.setCurrentProps();
2190          //myModule.updateprops(); uit laten staan: dit geeft iedere keer een savedesign
2191
2192     }
2193     this.editFont=function editFont(font,fontweight,displayname,waitlooptext,fontid,fontminimum) {
2194          this.fontdisplayname=displayname;
2195          this.fontid=fontid;
2196          this.fontminimum=fontminimum;
2197          myModule.currentFontMinimum=fontminimum;
2198          this.editText(this.text,this.alignment,font,fontweight,waitlooptext)
2199     }
2200
2201     this.editTextNew=function editTextNew(text,alignment,colorname,color,font,letterheight,fontweight,displayname,waitlooptext,fontid,fontminimum,lhfactor,useOutline,outlinecolor,outlinecolorname,outlinewidth,cutoutshape,textcurveradius,textcurvedirection,textcurverotation) {
2202          cutoutshape=cutoutshape||0;
2203          textcurveradius=textcurveradius||0;
2204          textcurvedirection=textcurvedirection||0;
2205          textcurverotation=textcurverotation||0;
2206          myModule.currentChange=20;
2207          myModule.waitlooptext=waitlooptext;
2208          myModule.showWait(1)
2209          this.fontdisplayname=displayname;
2210          this.fontid=fontid;
2211          this.font=font
2212                    this.fontminimum=fontminimum;
2213          this.alignment=alignment;
2214          this.colorname=colorname;
2215          this.letterheight=letterheight;
2216          this.color=color
2217                     this.text=text;
2218          this.bold=0;
2219          this.italic=0;
2220          if(fontweight==1 || fontweight==3) {
2221               this.bold=1;
2222          }
2223          if(fontweight==2 || fontweight==3) {
2224               this.italic=1;
2225          }
2226          this.oldOutlinecolor=outlinecolor;
2227          this.origOutlinecolor=outlinecolor;
2228          this.outlinecolor=outlinecolor;
2229          this.outlinecolorname=outlinecolorname;
2230          this.oldOutlinecolorname=outlinecolorname;
2231          this.origOutlinecolorname=outlinecolorname;
2232          this.textcurveradius=textcurveradius;
2233          this.textcurvedirection=textcurvedirection;
2234          this.textcurverotation=textcurverotation;
2235          myModule.setPickerColor("colorpickerbgProperties",colorname)
2236          myModule.setPickerColor("colorpickerbgProperties2",outlinecolorname)
2237          if(myModule.designtype==3 || myModule.designtype==5) {
2238               $(".v3foilfield").each(function() {
2239                    if($(this).data("foilname")==thisElement.colorname) {
2240                         thisElement.foilwidth=$(this).children().first().data("maxdimension");
2241                    }
2242               })
2243          }
2244          if(useOutline) {
2245               this.outlinewidth=outlinewidth
2246                                 this.useOutline=1
2247          } else {
2248               this.outlinewidth=0
2249                                 this.useOutline=0
2250          }
2251          this.cutoutshape=cutoutshape;
2252          var t1=this.text.replace(/€/g,"$$$|").replace(/&/g,"$||").replace(/\+/g,"_plus_").replace(/\u20ac/g,'$$$|');
2253          var xml="postdata=<?xml version='1.0' encoding='UTF-8'?><root><tekst><![CDATA["+t1+"]]></tekst>";
2254          xml+="<font>"+this.font+"</font>";
2255          var sendalignment=this.alignment-1;
2256          xml+="<align>"+sendalignment+"</align>";
2257          xml+="<bold>"+this.bold+"</bold>";
2258          xml+="<italic>"+this.italic+"</italic>";
2259          xml+="<color>"+this.colorname+"</color>";
2260          xml+="<useoutline>"+this.useOutline+"</useoutline>";
2261          xml+="<outlinecolor>"+this.outlinecolorname+"</outlinecolor>"
2262		xml+="<outlinewidth>"+this.outlinewidth+"</outlinewidth>";
2263		xml+="<designtype>"+myModule.designtype+"</designtype>";
2264		xml+="<letterheight>"+letterheight+"</letterheight>";
2265		xml+="<textcurveradius>"+this.textcurveradius+"</textcurveradius>"
2266		xml+="<textcurvedirection>"+this.textcurvedirection+"</textcurvedirection>"
2267		xml+="<textcurverotation>"+this.textcurverotation+"</textcurverotation>"
2268		xml+="<elementFillID>"+this.elementFillID+"</elementFillID>"
2269		xml+="<outlineFillID>"+this.outlineFillID+"</outlineFillID>"
2270          if(this.effect.hasEffect()) {
2271               xml+="<haseffect>1</haseffect>";
2272               xml+=this.effect.toXML();
2273          } else {
2274               xml+="<haseffect>0</haseffect>";
2275          }
2276          xml+="</root>"
2277
2278          $.ajax({
2279			type: "POST",
2280			dataType: "xml",
2281			data: xml,
2282			cache: false,
2283			url: "/123v3/text.php",
2284			success: function(xml) {
2285                    thisElement.startwaitlooptextedit(2,$(xml).find("textid").text())
2286               }
2287          });
2288     }
2289     this.setoncircle=function setoncircle(textcurveradius,textcurvedirection,textcurverotation) {
2290          textcurveradius=textcurveradius||0;
2291          textcurvedirection=textcurvedirection||0;
2292          textcurverotation=textcurverotation||0;
2293          this.textcurveradius=textcurveradius;
2294          this.textcurvedirection=textcurvedirection;
2295          this.textcurverotation=textcurverotation;
2296          
2297          myModule.currentChange=20;
2298          myModule.showWait(1)
2299          var t1=this.text.replace(/€/g,"$$$|").replace(/&/g,"$||").replace(/\+/g,"_plus_").replace(/\u20ac/g,'$$$|');
2300          var xml="postdata=<?xml version='1.0' encoding='UTF-8'?><root><tekst><![CDATA["+t1+"]]></tekst>";
2301          xml+="<font>"+this.font+"</font>";
2302          var sendalignment=this.alignment-1;
2303          xml+="<align>"+sendalignment+"</align>";
2304          xml+="<bold>"+this.bold+"</bold>";
2305          xml+="<italic>"+this.italic+"</italic>";
2306          xml+="<color>"+this.colorname+"</color>";
2307          xml+="<useoutline>"+this.useOutline+"</useoutline>";
2308          xml+="<outlinecolor>"+this.outlinecolorname+"</outlinecolor>"
2309		xml+="<outlinewidth>"+this.outlinewidth+"</outlinewidth>";
2310		xml+="<designtype>"+myModule.designtype+"</designtype>";
2311		xml+="<letterheight>"+this.letterheight+"</letterheight>";
2312		xml+="<textcurveradius>"+this.textcurveradius+"</textcurveradius>"
2313		xml+="<textcurvedirection>"+this.textcurvedirection+"</textcurvedirection>"
2314		xml+="<textcurverotation>"+this.textcurverotation+"</textcurverotation>"
2315		xml+="<elementFillID>"+this.elementFillID+"</elementFillID>"
2316		xml+="<outlineFillID>"+this.outlineFillID+"</outlineFillID>"
2317          if(this.effect.hasEffect()) {
2318               xml+="<haseffect>1</haseffect>";
2319               xml+=this.effect.toXML();
2320          } else {
2321               xml+="<haseffect>0</haseffect>";
2322          }
2323          xml+="</root>"
2324
2325          $.ajax({
2326			type: "POST",
2327			dataType: "xml",
2328			data: xml,
2329			cache: false,
2330			url: "/123v3/text.php",
2331			success: function(xml) {
2332                    thisElement.startwaitlooptextedit(2,$(xml).find("textid").text())
2333               }
2334          });
2335     }
2336     this.editTextFill=function editTextFill(fillID) {
2337          if(myModule.otherfillOutline==1) {
2338               this.outlinecolorname="E"+fillID;
2339          } else {
2340               this.colorname="E"+fillID;
2341          }
2342          myModule.showWait(1)
2343          var t1=this.text.replace(/€/g,"$$$|").replace(/&/g,"$||").replace(/\+/g,"_plus_").replace(/\u20ac/g,'$$$|');
2344          var xml="postdata=<?xml version='1.0' encoding='UTF-8'?><root><tekst><![CDATA["+t1+"]]></tekst>";
2345          xml+="<font>"+this.font+"</font>";
2346          var sendalignment=this.alignment-1;
2347          xml+="<align>"+sendalignment+"</align>";
2348          xml+="<bold>"+this.bold+"</bold>";
2349          xml+="<italic>"+this.italic+"</italic>";
2350          xml+="<color>"+this.colorname+"</color>";
2351          xml+="<useoutline>"+this.useOutline+"</useoutline>";
2352          xml+="<outlinecolor>"+this.outlinecolorname+"</outlinecolor>"
2353               xml+="<outlinewidth>"+this.outlinewidth+"</outlinewidth>";
2354          xml+="<designtype>"+myModule.designtype+"</designtype>";
2355          xml+="<letterheight>"+this.letterheight+"</letterheight>";
2356          xml+="<textcurveradius>"+this.textcurveradius+"</textcurveradius>"
2357               xml+="<textcurvedirection>"+this.textcurvedirection+"</textcurvedirection>"
2358                    xml+="<textcurverotation>"+this.textcurverotation+"</textcurverotation>"
2359                         xml+="<elementFillID>"+this.elementFillID+"</elementFillID>"
2360                              xml+="<outlineFillID>"+this.outlineFillID+"</outlineFillID>"
2361          if(this.effect.hasEffect()) {
2362               xml+="<haseffect>1</haseffect>";
2363               xml+=this.effect.toXML();
2364          } else {
2365               xml+="<haseffect>0</haseffect>";
2366          }
2367          xml+="</root>"
2368
2369          $.ajax({
2370			type: "POST",
2371			dataType: "xml",
2372			data: xml,
2373			cache: false,
2374			url: "/123v3/text.php",
2375			success: function(xml) {
2376                    thisElement.startwaitlooptextedit(2,$(xml).find("textid").text())
2377               }
2378          });
2379
2380     }
2381     this.editTextOnly=function editTextOnly(text,waitlooptext) {
2382          var fontweight=0;
2383          if(this.bold==1) {
2384               if(this.italic==1) {
2385                    fontweight=3;
2386               } else {
2387                    fontweight=1;
2388               }
2389          } else {
2390               if(this.italic==1) {
2391                    fontweight=2;
2392               }
2393          }
2394          this.editText(text,this.alignment,this.font,fontweight,waitlooptext)
2395     }
2396     this.editAlignmentOnly=function editAlignmentOnly(alignment,waitlooptext) {
2397          myModule.currentChange=20;
2398          var fontweight=0;
2399          if(this.bold==1) {
2400               if(this.italic==1) {
2401                    fontweight=3;
2402               } else {
2403                    fontweight=1;
2404               }
2405          } else {
2406               if(this.italic==1) {
2407                    fontweight=2;
2408               }
2409          }
2410          this.editText(this.text,alignment,this.font,fontweight,waitlooptext)
2411//		if(newwidth>0){
2412//			if(this.useOutline==0){
2413//				this.outlinecolorname=$("#colorpickerProperties2").data("colorname");
2414//				this.outlinecolor=$("#colorpickerProperties2").css("background-color");
2415//			}
2416//			this.useOutline=1;
2417//		}else{
2418//			this.useOutline=0;
2419//		}
2420//		this.editShape(alignmentwaitlooptext)
2421     }
2422     this.editTexteffect=function editTexteffect() {
2423          myModule.currentChange=35;
2424          this.editText(this.text,this.alignment,this.font,this.fontweight,"momentje");
2425     }
2426     this.changeElemenOutlinewidth=function changeElemenOutlinewidth(newwidth) {
2427     	
2428          if(newwidth>=100) {
2429               newwidth=99;
2430          }
2431          myModule.currentChange=26;
2432          if(this.elementtype==1) {
2433               this.outlinewidth=newwidth;
2434               if(newwidth>0) {
2435                    if(this.useOutline==0) {
2436                         this.outlinecolorname=$("#colorpickerProperties2").data("colorname");
2437                         this.outlinecolor=$("#colorpickerProperties2").css("background-color");
2438                    }
2439                    this.useOutline=1;
2440               } else {
2441                    this.useOutline=0;
2442               }
2443               
2444               this.editShape(alignmentwaitlooptext)
2445               
2446          } else if(this.elementtype==4) {
2447               if(newwidth>0) {
2448                    if(this.useOutline==0) {
2449                         this.outlinecolorname=$("#colorpickerProperties2").data("colorname");
2450                         this.outlinecolor=$("#colorpickerProperties2").css("border-top-color");
2451                         this.origOutlinecolorname=$("#colorpickerProperties2").data("colorname");
2452                         this.oldOutlinecolorname=$("#colorpickerProperties2").data("colorname");
2453                         this.origOutlinecolor=$("#colorpickerProperties2").css("border-top-color");
2454                         this.oldOutlinecolor=$("#colorpickerProperties2").css("border-top-color");
2455
2456
2457                    }
2458                    this.useOutline=1;
2459               } else {
2460                    this.useOutline=0;
2461               }
2462               this.outlinewidth=newwidth;
2463               this.editClipart(alignmentwaitlooptext)
2464          } else {
2465               this.outlinewidth=newwidth;
2466               var fontweight=0;
2467               if(this.bold==1) {
2468                    if(this.italic==1) {
2469                         fontweight=3;
2470                    } else {
2471                         fontweight=1;
2472                    }
2473               } else {
2474                    if(this.italic==1) {
2475                         fontweight=2;
2476                    }
2477               }
2478               if(newwidth>0) {
2479                    if(this.useOutline==0) {
2480                         this.outlinecolorname=$("#colorpickerProperties2").data("c
2480olorname");
2481                         this.outlinecolor=$("#colorpickerProperties2").css("background-color");
2482                    }
2483                    this.useOutline=1;
2484               } else {
2485                    this.useOutline=0;
2486               }
2487               
2488               this.editText(this.text,this.alignment,this.font,fontweight,alignmentwaitlooptext)
2489               
2490          }
2491     }
2492     this.mobilechangeoutline=function mobilechangeoutline(newwidth, color, colorname){
2493		this.outlinecolor=color;
2494		this.outlinecolorname=colorname;
2495         if(newwidth>=100) {
2496               newwidth=99;
2497          }
2498          myModule.currentChange=26;
2499          if(this.elementtype==1) {
2500               this.outlinewidth=newwidth;
2501               if(newwidth>0) {
2502                    if(this.useOutline==0) {
2503                         this.outlinecolorname=$("#colorpickerProperties2").data("colorname");
2504                         this.outlinecolor=$("#colorpickerProperties2").css("background-color");
2505                    }
2506                    this.useOutline=1;
2507               } else {
2508                    this.useOutline=0;
2509               }
2510               
2511               this.editShape(alignmentwaitlooptext)
2512               
2513          } else if(this.elementtype==4) {
2514               if(newwidth>0) {
2515                     this.useOutline=1;
2516               } else {
2517                    this.useOutline=0;
2518               }
2519               this.outlinewidth=newwidth;
2520               this.editClipart(alignmentwaitlooptext)
2521          } else {
2522               this.outlinewidth=newwidth;
2523               var fontweight=0;
2524               if(this.bold==1) {
2525                    if(this.italic==1) {
2526                         fontweight=3;
2527                    } else {
2528                         fontweight=1;
2529                    }
2530               } else {
2531                    if(this.italic==1) {
2532                         fontweight=2;
2533                    }
2534               }
2535               if(newwidth>0) {
2536                    if(this.useOutline==0) {
2537                         this.outlinecolorname=colorname;
2538                         this.outlinecolor=color;
2539                    }
2540                    this.useOutline=1;
2541               } else {
2542                    this.useOutline=0;
2543               }
2544               
2545               this.editText(this.text,this.alignment,this.font,fontweight,alignmentwaitlooptext)
2546               
2547          }
2548     	
2549     }
2550     this.changeElemenCornerradius=function changeElemenCornerradius(box) {
2551          var newval=$(box).val()*10;
2552          if(newval>this.width/2 || newval>this.height/2) {
2553               newval=Math.min(this.width,this.height)/2;
2554               newval=Math.round(newval);
2555               $(box).val(newval/10);
2556          }
2557          this.cornerradius=newval;
2558          this.editShape(alignmentwaitlooptext);
2559     }
2560     this.editShapeDialog=function editShapeDialog(width,height,linewidth,cornerradius,backgroundcolorname,backgroundcolor,outlinecolorname,outlinecolor,shapetype,waitlooptext,lineType,lineCurves,variablecorners,placeascutting) {
2561          myModule.waitlooptext=waitlooptext;
2562          if(waitlooptext!="*") {
2563               myModule.showWait(1);
2564          }
2565          this.width=width;
2566          this.height=height;
2567          this.cornerradius=cornerradius;
2568          this.colorname=backgroundcolorname;
2569          this.color=backgroundcolor;
2570          linewidth=linewidth||0;
2571          this.outlinewidth=linewidth;
2572          this.useOutline=linewidth>0;
2573          outlinecolorname=outlinecolorname||"";
2574          outlinecolor=outlinecolor||"";
2575          this.oldOutlinecolor=outlinecolor;
2576          this.origOutlinecolor=outlinecolor;
2577          this.outlinecolor=outlinecolor;
2578          this.outlinecolorname=outlinecolorname;
2579          this.oldOutlinecolorname=outlinecolorname;
2580          this.origOutlinecolorname=outlinecolorname;
2581          this.lineType=lineType;
2582          this.lineCurves=lineCurves;
2583          this.variablecorners=variablecorners;
2584          this.placeascutting=placeascutting
2585          if(placeascutting==1){
2586          	this.kisscuts=1;
2587          	this.diecuts=0;
2588          }else if(placeascutting==2){
2589          	this.diecuts=1;
2590          	this.kisscuts=0;
2591          }else{
2592          	this.kisscuts=0;
2593          	this.diecuts=0;
2594          }
2595          this.shapetype=shapetype;
2596          this.hwRatio=height/width;
2597          this.hasColor=backgroundcolorname!="Transparent";
2598          if(myModule.designtype==3 || myModule.designtype==5) {
2599               $(".v3foilfield").each(function() {
2600                    if($(this).data("foilname")==thisElement.colorname) {
2601                         thisElement.foilwidth=$(this).children().first().data("maxdimension");
2602                    }
2603               })
2604          }
2605          var xml="postdata=<?xml version='1.0'?><root>";
2606          xml+="<width>"+this.width+"</width>";
2607          xml+="<height>"+this.height+"</height>";
2608          xml+="<outlinewidth>"+this.outlinewidth+"</outlinewidth>";
2609          xml+="<cornerradius>"+this.cornerradius+"</cornerradius>";
2610          xml+="<backgroundcolor>"+this.colorname+"</backgroundcolor>";
2611          xml+="<outlinecolor>"+this.outlinecolorname+"</outlinecolor>";
2612          xml+="<shapetype>"+this.shapetype+"</shapetype>";
2613          xml+="<lineType>"+this.lineType+"</lineType>";
2614          xml+="<lineCurves>"+this.lineCurves+"</lineCurves>";
2615          xml+="<variablecorners>"+this.variablecorners+"</variablecorners>";
2616          xml+="<placeascutting>"+this.placeascutting+"</placeascutting>";
2617          xml+="<designtype>"+myModule.designtype+"</designtype>";
2618          if(this.effect.hasEffect()) {
2619               xml+="<haseffect>1</haseffect>";
2620               xml+=this.effect.toXML();
2621          } else {
2622               xml+="<haseffect>0</haseffect>";
2623          }
2624          xml+="</root>";
2625          $.ajax({
2626			type: "POST",
2627			dataType: "xml",
2628			Content_type:"text/html; charset=utf-8",
2629			data: xml,
2630			cache: false,
2631			url: "/123v3/shape.php",
2632			success: function(xml) {
2633                    thisElement.startwaitloopshapeedit(1,$(xml).find("shapeid").text())
2634               }
2635          });
2636
2637
2638     }
2639     this.editShape=function editShape(waitlooptext) {
2640          myModule.waitlooptext=waitlooptext;
2641          if(waitlooptext!="*") {
2642               myModule.showWait(1);
2643          } else {
2644               $("#dropspinner"+this.elementid).show();
2645          }
2646          this.oldOutlinecolor=this.outlinecolor;
2647          this.origOutlinecolor=this.outlinecolor;
2648          this.oldOutlinecolorname=this.outlinecolorname;
2649          this.origOutlinecolorname=this.outlinecolorname;
2650          var xml="postdata=<?xml version='1.0'?><root>";
2651          xml+="<width>"+this.width+"</width>";
2652          xml+="<height>"+this.height+"</height>";
2653          xml+="<outlinewidth>"+this.outlinewidth+"</outlinewidth>";
2654          xml+="<cornerradius>"+this.cornerradius+"</cornerradius>";
2655          xml+="<backgroundcolor>"+this.colorname+"</backgroundcolor>";
2656          xml+="<outlinecolor>"+this.outlinecolorname+"</outlinecolor>";
2657          xml+="<shapetype>"+this.shapetype+"</shapetype>";
2658          xml+="<designtype>"+myModule.designtype+"</designtype>";
2659          xml+="<elementfillid>"+this.elementFillID+"</elementfillid>";
2660          xml+="<outlinefillid>"+this.outlineFillID+"</outlinefillid>";
2661          xml+="<lineType>"+this.lineType+"</lineType>";
2662          xml+="<lineCurves>"+this.lineCurves+"</lineCurves>";
2663          xml+="<variablecorners>"+this.variablecorners+"</variablecorners>";
2664          xml+="<placeascutting>"+this.placeascutting+"</placeascutting>";
2665          xml+="<filloutline>"+myModule.otherfillOutline+"</filloutline>"
2666          if(this.effect.hasEffect()) {
2667               xml+="<haseffect>1</haseffect>";
2668               xml+=this.effect.toXML();
2669          } else {
2670               xml+="<haseffect>0</haseffect>";
2671          }
2672          xml+="</root>";
2673          $.ajax({
2674			type: "POST",
2675			dataType: "xml",
2676			Content_type:"text/html; charset=utf-8",
2677			data: xml,
2678			cache: false,
2679			url: "/123v3/shape.php",
2680			success: function(xml) {
2681                    thisElement.startwaitloopshapeedit(1,$(xml).find("shapeid").text())
2682               }
2683          });
2684     }
2685     this.editShapeeffect=function editShapeeffect() {
2686          myModule.currentChange=35;
2687          this.editShape("momentje, je voorbeeld wordt gemaakt");
2688     }
2689     this.editShapeFill=function editShapeFill(fillID) {
2690          if(myModule.otherfillOutline==1) {
2691               this.outlinecolorname="E"+fillID;
2692          } else {
2693               this.colorname="E"+fillID;
2694          }
2695          this.editShape("");
2696     }
2697     this.editShapeFilldrop=function editShapeFilldrop(fillID) {
2698          if(myModule.otherfillOutline==1) {
2699               this.outlinecolorname="E"+fillID;
2700          } else {
2701               this.colorname="E"+fillID;
2702          }
2703          this.editShape("*");
2704     }
2705     this.editText = function editText(text,alignment,font,fontweight,waitlooptext) {
2706          myModule.waitlooptext=waitlooptext;
2707          myModule.showWait(1)
2708          this.font=font
2709          this.alignment=alignment;
2710
2711          this.text=text;
2712          this.bold=0;
2713          this.italic=0;
2714          if(fontweight==1 || fontweight==3) {
2715               this.bold=1;
2716          }
2717          if(fontweight==2 || fontweight==3) {
2718               this.italic=1;
2719          }
2720          this.oldOutlinecolor=this.outlinecolor;
2721          this.origOutlinecolor=this.outlinecolor;
2722          this.oldOutlinecolorname=this.outlinecolorname;
2723          this.origOutlinecolorname=this.outlinecolorname;
2724          var t1=this.text.replace(/€/g,"$$$|").replace(/&/g,"$||").replace(/\+/g,"_plus_").replace(/\u20ac/g,'$$$|');
2725          var xml="postdata=<?xml version='1.0' encoding='UTF-8'?><root><tekst><![CDATA["+t1+"]]></tekst>";
2726          xml+="<font>"+this.font+"</font>";
2727          var sendalignment=this.alignment-1;
2728          xml+="<align>"+sendalignment+"</align>";
2729          xml+="<bold>"+this.bold+"</bold>";
2730          xml+="<italic>"+this.italic+"</italic>";
2731          xml+="<color>"+this.colorname+"</color>";
2732          xml+="<useoutline>"+this.useOutline+"</useoutline>";
2733          xml+="<outlinecolor>"+this.outlinecolorname+"</outlinecolor>"
2734		xml+="<outlinewidth>"+this.outlinewidth+"</outlinewidth>"
2735		xml+="<designtype>"+myModule.designtype+"</designtype>";
2736		xml+="<letterheight>"+this.letterheight+"</letterheight>"
2737		xml+="<textcurveradius>"+this.textcurveradius+"</textcurveradius>"
2738		xml+="<textcurvedirection>"+this.textcurvedirection+"</textcurvedirection>"
2739		xml+="<textcurverotation>"+this.textcurverotation+"</textcurverotation>"
2740		xml+="<elementFillID>"+this.elementFillID+"</elementFillID>"
2741		xml+="<outlineFillID>"+this.outlineFillID+"</outlineFillID>"
2742          if(this.effect.hasEffect()) {
2743               xml+="<haseffect>1</haseffect>";
2744               xml+=this.effect.toXML();
2745          } else {
2746               xml+="<haseffect>0</haseffect>";
2747          }
2748
2749          xml+="</root>";
2750          $.ajax({
2751			type: "POST",
2752			dataType: "xml",
2753			data: xml,
2754			cache: false,
2755			url: "/123v3/text.php",
2756			success: function(xml) {
2757                    thisElement.startwaitlooptextedit(2,$(xml).find("textid").text())
2758               }
2759          });
2760     }
2761     this.editClipart = function editClipart(waitlooptext) {
2762          if(waitlooptext!="*") {
2763               myModule.waitlooptext=waitlooptext;
2764               myModule.showWait(1)
2765          } else {
2766               $("#dropspinner"+this.elementid).show();
2767          }
2768          this.oldOutlinecolor=this.outlinecolor;
2769          this.origOutlinecolor=this.outlinecolor;
2770          this.oldOutlinecolorname=this.outlinecolorname;
2771          this.origOutlinecolorname=this.outlinecolorname;
2772          xml="postdata=<root><clipartID>"+this.libraryID+"</clipartID>"
2773          xml+="<color>"+this.colorname+"</color>";
2774          xml+="<useoutline>"+this.useOutline+"</useoutline>";
2775          xml+="<outlinecolor>"+this.outlinecolorname+"</outlinecolor>"
2776          xml+="<outlinewidth>"+this.outlinewidth+"</outlinewidth>"
2777          xml+="<designtype>"+myModule.designtype+"</designtype>";
2778          xml+="<elementfillID>"+this.elementFillID+"</elementfillID>"
2779          xml+="<outlinefillID>"+this.outlineFillID+"</outlinefillID>"
2780          if(this.effect.hasEffect()) {
2781               xml+="<haseffect>1</haseffect>";
2782               xml+=this.effect.toXML();
2783          } else {
2784               xml+="<haseffect>0</haseffect>";
2785          }
2786          xml+="</root>";
2787          $.ajax({
2788			type: "POST",
2789			dataType: "xml",
2790			Content_type:"text/html; charset=utf-8",
2791			data: xml,
2792			cache: false,
2793			url: "/123v3/clipart.php",
2794			success: function(xml) {
2795                    thisElement.startwaitloopClipEdit(4,$(xml).find("clipartid").text())
2796                    thisElement.clipoutline=$(xml).find("clipartid").text()
2797               }
2798          });
2799     }
2800     this.editUploadEffect=function editUploadEffect() {
2801          this.picWidth=parseFloat(this.width)/(1-parseFloat(this.marginleft)-parseFloat(this.marginright));
2802          this.picHeight=parseFloat(this.height)/(1-parseFloat(this.margintop)-parseFloat(this.marginbottom));
2803          var thistype=this.elementtype
2804          if(this.elementtype=="4") {
2805               thistype=10
2806          }
2807          myModule.waitlooptext="momentje";
2808          myModule.showWait(1)
2809          var xml="postdata=<?xml version='1.0'?><root>";
2810          xml+="<uploadID>"+this.uploadID+"</uploadID>";
2811          xml+="<cropID>"+this.cropID+"</cropID>";
2812          xml+="<margintop>"+this.margintop+"</margintop>";
2813          xml+="<marginright>"+this.marginright+"</marginright>";
2814          xml+="<marginbottom>"+this.marginbottom+"</marginbottom>";
2815          xml+="<marginleft>"+this.marginleft+"</marginleft>";
2816          xml+="<cropRotation>"+this.cropRotation+"</cropRotation>";
2817          xml+="<filename>"+this.filesource+"</filename>"
2818		xml+="<elementtype>"+this.elementtype+"</elementtype>"
2819		xml+="<libraryID>"+this.libraryID+"</libraryID>"
2820		xml+="<color>"+this.colorname+"</color>"
2821		xml+="<useoutline>"+this.useOutline+"</useoutline>"
2822		xml+="<outlinecolor>"+this.outlinecolorname+"</outlinecolor>"
2823		xml+="<outlinewidth>"+this.outlinewidth+"</outlinewidth>"
2824          if(this.effect.hasEffect()) {
2825               xml+="<haseffect>1</haseffect>";
2826               xml+=this.effect.toXML();
2827          } else {
2828               xml+="<haseffect>0</haseffect>";
2829          }
2830          xml+="</root>";
2831          $.ajax({
2832			type: "POST",
2833			dataType: "xml",
2834			Content_type:"text/html; charset=utf-8",
2835			data: xml,
2836			cache: false,
2837			url: "/123v3/crop.php",
2838			success: function(xml) {
2839                    thisElement.startwaitloop(thistype,$(xml).find("cropid").text())
2840	    		}
2841	     });
2842	}
2843     this.editClipartEffect=function editClipartEffect() {
2844          myModule.waitlooptext="momentje";
2845          myModule.showWait(1)
2846          if(this.margintop>0 || this.marginright>0 || this.marginbottom>0 || this.margintop>0 || this.cropID>0) {
2847
2848               this.setCropvalues(this.margintop,this.marginright,this.marginbottom,this.marginleft,this.cropID,this.cropRotation)
2849          } else {
2850               this.editClipart("momentje");
2851          }
2852
2853
2854     }
2855     this.editClipartFill=function editClipartFill(fillID) {
2856          if(myModule.otherfillOutline==1) {
2857               this.outlinecolorname="E"+fillID;
2858          } else {
2859               this.colorname="E"+fillID;
2860          }
2861          if(this.margintop>0 || this.marginright>0 || this.marginbottom>0 || this.margintop>0 || this.cropID>0) {
2862               this.setCropvalues(this.margintop,this.marginright,this.marginbottom,this.marginleft,this.cropID,this.cropRotation)
2863     	}else{
2864          	this.editClipart("");
2865     	}
2866     }
2867     this.editClipartFillDrop=function editClipartFill(fillID) {
2868          if(myModule.otherfillOutline==1) {
2869               this.outlinecolorname="E"+fillID;
2870          } else {
2871               this.colorname="E"+fillID;
2872          }
2873          this.editClipart("*");
2874     }
2875     this.editQrTextOnly=function editQrTextOnly(text,waitlooptext) {
2876          if(this.qrlogoid>0) {
2877               this.text=text;
2878               this.replaceQrDirect();
2879          } else {
2880               this.editQrOnly(text,this.protocol,this.qualitylevel,waitlooptext,this.pixelshape)
2881          }
2882     }
2883     this.editQrOnly=function editQrOnly(text,protocol,qualitylevel,waitlooptext,pixelshape) {
2884          pixelshape=pixelshape||0;
2885          myModule.waitlooptext=waitlooptext;
2886          myModule.showWait(1)
2887          this.text=text;
2888          this.protocol=protocol;
2889          this.qualitylevel=qualitylevel;
2890          this.pixelshape=pixelshape;
2891          var xml="postdata=<root><tekst><![CDATA["+this.text.replace(/&/g,"@amp@")+"]]></tekst>";
2892          xml+="<qualitylevel>"+this.qualitylevel+"</qualitylevel>";
2893          xml+="<pixelshape>"+this.pixelshape+"</pixelshape>";
2894          xml+="<color>"+this.colorname+"</color>";
2895          xml+="<barcodetype>"+this.barcodetype+"</barcodetype></root>";
2896          $.ajax({
2897			type: "POST",
2898			dataType: "xml",
2899			data: xml,
2900			cache: false,
2901			url: "/123v3/qr.php",
2902			success: function(xml) {
2903                    startwaitloopqredit(5,$(xml).find("qrid").text())
2904               }
2905          });
2906
2907     }
2908     function startwaitloopqredit(elementType,elementID) {
2909          this.elementtype=elementType;
2910          this.timerID=elementID;
2911          if(thisElement.timerVar>0){
2912          	clearInterval(thisElement.timerVar)
2913          }
2914          this.timerVar=setInterval(myTimerQrEdit,500);
2915     }
2916     this.startwaitlooptextedit=function startwaitlooptextedit(elementType,elementID) {
2917          this.elementtype=elementType;
2918          this.timerID=elementID;
2919          if(thisElement.timerVar>0){
2920          	clearInterval(thisElement.timerVar)
2921          }
2922          this.timerVar=setInterval(thisElement.myTimerTextEdit,500);
2923     }
2924     this.startwaitloopClipEdit=function startwaitloopClipEdit(elementType,elementID) {
2925          this.elementtype=elementType;
2926          this.timerID=elementID;
2927          if(thisElement.timerVar>0){
2928          	clearInterval(thisElement.timerVar)
2929          }
2930          this.timerVar=setInterval(thisElement.myTimerClipEdit,500);
2931     }
2932     this.startwaitloopshapeedit=function startwaitloopshapeedit(elementType,elementID) {
2933          this.elementtype=elementType;
2934          this.timerID=elementID;
2935          if(thisElement.timerVar>0){
2936          	clearInterval(thisElement.timerVar)
2937          }
2938          this.timerVar=setInterval(thisElement.myTimerShapeEdit,500);
2939     }
2940     function colorQr() {
2941          thisElement.changeColor(thisElement.color,thisElement.colorname);
2942     }
2943     this.myTimerShapeEdit=function myTimerShapeEdit() {
2944          xml='postdata=<root><elementType>'+thisElement.elementtype+'</elementType><id>'+thisElement.timerID+'</id></root>';
2945          var tmv=thisElement.timerVar;
2946          var elementType=thisElement.elementtype;
2947
2948          $.ajax({
2949			type: "POST",
2950			dataType: "xml",
2951			data: xml,
2952			cache: false,
2953			url: "/123v3/elementready.php",
2954			success: function(xml) {
2955                    if($(xml).find("state").text()==1) {
2956                         clearInterval(tmv);
2957                         thisElement.timerVar=0;
2958                         if(elementType==1) {
2959                              var shapeid=$(xml).find("id").text();
2960                              var eff=$(xml).find("effectratios");
2961                              var origwidth=thisElement.width/thisElement.effect.widthratio;
2962                              var origheight=thisElement.height/thisElement.effect.heightratio;
2963                              if($(eff).find("width").text()!="") {
2964                                   thisElement.effect.widthratio=$(eff).find("width").text();
2965                                   thisElement.effect.heightratio=$(eff).find("height").text();
2966                                   thisElement.width=origwidth*Number($(eff).find("width").text());
2967                                   thisElement.height=origheight*Number($(eff).find("height").text());
2968                              } else {
2969                                   thisElement.effect.widthratio=1;
2970                                   thisElement.effect.heightratio=1;
2971                                   thisElement.width=origwidth;
2972                                   thisElement.height=origheight;
2973                              }
2974
2975                              thisElement.replaceShape(shapeid);
2976                         }
2977                    }
2978                    if($(xml).find("state").text()==2) {
2979                         clearInterval(tmv);
2980                         thisElement.timerVar=0;
2981                    }
2982               }
2983          });
2984     }
2985     this.myTimerTextEdit=function myTimerTextEdit() {
2986          xml='postdata=<root><elementType>'+thisElement.elementtype+'</elementType><id>'+thisElement.timerID+'</id></root>';
2987          var tmv=thisElement.timerVar;
2988          var elementType=thisElement.elementtype;
2989          $.ajax({
2990			type: "POST",
2991			dataType: "xml",
2992			data: xml,
2993			cache: false,
2994			url: "/123v3/elementready.php",
2995			success: function(xml) {
2996                    if($(xml).find("state").text()==1) {
2997                         clearInterval(tmv);
2998                         thisElement.timerVar=0;
2999                         if(elementType==2) {
3000                              var hwratio=$(xml).find("hwratio").text()
3001                              var tlratio=$(xml).find("textletterratio").text()
3002                              var textid=$(xml).find("id").text();
3003                              var usesvg=$(xml).find("usesvg").text();
3004                              var curvewidthratio=$(xml).find("curvewidthratio").text();
3005                              if($(xml).find("effectratios").text().lenght>0) {
3006                                   var eff=$(xml).find("effectratios");
3007                                   thisElement.effect.widthratio=$(effect).find("width").text();
3008                                   thisElement.effect.heightratio=$(effect).find("height").text();
3009                                   thisElement.effect.leftratio=$(effect).find("left").text();
3010                                   thisElement.effect.topratio=$(effect).find("top").text();
3011                              }
3012                              thisElement.replaceText(hwratio,tlratio,textid,usesvg,curvewidthratio);
3013                         }
3014                    }
3015                    if($(xml).find("state").text()==2) {
3016                         clearInterval(tmv);
3017                         thisElement.timerVar=0;
3018                    }
3019               }
3020          });
3021     }
3022     this.myTimerClipEdit=function myTimerClipEdit() {
3023          xml='postdata=<root><elementType>'+thisElement.elementtype+'</elementType><id>'+thisElement.timerID+'</id></root>';
3024          var tmv=thisElement.timerVar;
3025          var elementType=thisElement.elementtype;
3026
3027          $.ajax({
3028type: "POST",
3029dataType: "xml",
3030data: xml,
3031cache: false,
3032url: "/123v3/elementready.php",
3033success: function(xml) {
3034                    if($(xml).find("state").text()==1) {
3035                         clearInterval(tmv);
3036                         thisElement.timerVar=0;
3037                         if(elementType==4) {
3038                              var hwratio=$(xml).find("heightwidthratio").text()
3039                              var clipid=$(xml).find("clipartid").text();
3040                              var eff=$(xml).find("effectratios");
3041                              var origwidth=thisElement.width/thisElement.effect.widthratio;
3042                              var origheight=thisElement.height/thisElement.effect.heightratio;
3043                              if($(eff).find("width").text()!="") {
3044                                   thisElement.effect.widthratio=$(eff).find("width").text();
3045                                   thisElement.effect.heightratio=$(eff).find("height").text();
3046                                   thisElement.width=origwidth*Number($(eff).find("width").text());
3047                                   thisElement.height=origheight*Number($(eff).find("height").text());
3048                              } else {
3049                                   thisElement.effect.widthratio=1;
3050                                   thisElement.effect.heightratio=1;
3051                                   thisElement.width=origwidth;
3052                                   thisElement.height=origheight;
3053                              }
3054                              thisElement.replaceClip(hwratio,clipid);
3055                         }
3056                    }
3057                    if($(xml).find("state").text()==2) {
3058                         clearInterval(tmv);
3059                         thisElement.timerVar=0;
3060                    }
3061               }
3062          });
3063     }
3064
3065     function myTimerQrEdit() {
3066          xml='postdata=<root><elementType>'+this.elementtype+'</elementType><id>'+this.timerID+'</id></root>';
3067          var tmv=this.timerVar;
3068          var elementType=this.elementtype;
3069
3070          $.ajax({
3071			type: "POST",
3072			dataType: "xml",
3073			data: xml,
3074			cache: false,
3075			url: "/123v3/elementready.php",
3076			success: function(xml) {
3077                    if($(xml).find("state").text()==1) {
3078                         clearInterval(tmv);
3079                         thisElement.timerVar=0;
3080                         if(elementType==5) {
3081                              var qrid=$(xml).find("id").text();
3082                              var hwratio=$(xml).find("heightwidthratio").text()
3083                              replaceQr(qrid,hwratio);
3084                         }
3085                    }
3086                    if($(xml).find("state").text()==2) {
3087                         clearInterval(tmv);
3088                         thisElement.timerVar=0;
3089                    }
3090               }
3091          });
3092     }
3093     function replaceQr(qrid,hwratio) {
3094          myModule.hideDialog();
3095          thisElement.hwRatio=hwratio;
3096          thisElement.hwRatioOriginal=hwratio;
3097          thisElement.qrid=qrid;
3098          var lh=myModule.pxhoogte/2;
3099          $("#element"+thisElement.elementid).html("<img draggable='false' class='v3qrclass' src='/clientfiles/qr"+qrid+".png' id='elementimage"+thisElement.elementid+"' >");
3100          var pb=myModule.size2pix(thisElement.width);
3101          var ph=myModule.size2pix(thisElement.height);
3102          $("#element"+thisElement.elementid).css("width",pb+'px');
3103          $("#element"+thisElement.elementid).css("height",ph+'px');
3104          thisElement.filesource="qr"+qrid+".png";
3105          myModule.setCurrentProps();
3106          myModule.updateprops();
3107          selectwindow.attachToElement(thisElement)
3108          myModule.hideDialog();
3109          setTimeout(colorQr,200);
3110     }
3111
3112     this.replaceShape=function replaceShape(shapeid) {
3113          myModule.hideDialog();
3114          thisElement.shapeid=shapeid;
3115          $("#element"+thisElement.elementid).html("<img draggable='false' class='v3textclass' src='/teksten/shape"+shapeid+".png' id='elementimage"+thisElement.elementid+"' >");
3116          var ph=myModule.size2pix(thisElement.height);
3117          var pb=myModule.size2pix(thisElement.width);
3118          $("#element"+thisElement.elementid).css("width",pb+'px');
3119          $("#element"+thisElement.elementid).css("height",ph+'px');
3120          thisElement.filesource="/teksten/shape"+shapeid+".png";
3121          myModule.setCurrentProps();
3122          myModule.updateprops();
3123          thisElement.visibleElement=$("#element"+thisElement.elementid);
3124          thisElement.setTransparency();
3125          thisElement.setTransparency();
3126          if(thisElement.isdroptarget==1) {
3127               thisElement.setAsDroptarget(true);
3128          }
3129          selectwindow.attachToElement(thisElement)
3130          for (var i = 0; i < myModule.elements.length; i++) {
3131               if(myModule.elements[i].elementid==thisElement.elementid) {
3132                    if(myModule.elements[i].locked!=1||$("#elementAdminbtn").length) {
3133                         myModule.currentElement=myModule.elements[i];
3134                         selectwindow.attachToElement(myModule.currentElement);
3135                         myModule.setCurrentProps();
3136                         myModule.currentElement.setlockinginfo();
3137                    }
3138               }
3139          }
3140
3141          myModule.hideDialog();
3142     }
3143
3144     this.replaceText=function replaceText(hwratio,tlratio,textid,usesvg, curvewidthratio) {
3145          if(typeof(circleflag)!="undefined") {
3146               if(circleflag!==1) {
3147                    myModule.hideDialog();
3148               }
3149          } else {
3150               myModule.hideDialog();
3151          }
3152          var hwr=thisElement.height/thisElement.width
3153                  var stretch = thisElement.hwRatioOriginal/hwr
3154                                thisElement.textid=textid;
3155          thisElement.hwRatio=hwratio;
3156          thisElement.hwRatioOriginal=hwratio;
3157          thisElement.tlRatio=tlratio;
3158          thisElement.usesvg=usesvg
3159                             thisElement.curvewidthratio=curvewidthratio;
3160          var lh=thisElement.letterheight/myModule.height*myModule.pxhoogte;
3161          var ph=lh*tlratio;
3162          var pb=ph/hwratio*stretch;
3163          //thisElement.hwRatio=ph/pb;
3164          //thisElement.hwRatioOriginal=ph/pb;
3165
3166
3167          if(thisElement.alignment==3) {
3168               thisElement.left=thisElement.left-(myModule.pix2size(pb)-thisElement.width);
3169          }
3170          if(thisElement.alignment==2) {
3171               thisElement.left=thisElement.left-(myModule.pix2size(pb)-thisElement.width)/2;
3172          }
3173
3174          thisElement.width=myModule.pix2size(pb);
3175          thisElement.height=myModule.pix2size(ph);
3176
3177
3178
3179          if(thisElement.usesvg==1) {
3180               $("#element"+thisElement.elementid).html('')
3181               $("#element"+thisElement.elementid).css("width",pb+'px');
3182               $("#element"+thisElement.elementid).css("height",ph+'px');
3183               $("#element"+thisElement.elementid).css("left",myModule.left2pix(thisElement.left)+'px')
3184               $("#element"+thisElement.elementid).load('/teksten/'+textid+'.svg',function() {
3185                    thisElement.fitsvg()
3186               })
3187               thisElement.filesource="/teksten/"+textid+".svg";
3188          } else {
3189               $("#element"+thisElement.elementid).html("<img draggable='false' class='v3textclass' src='/teksten/"+textid+".png' id='elementimage"+thisElement.elementid+"' >");
3190               $("#element"+thisElement.elementid).css("width",pb+'px');
3191               $("#element"+thisElement.elementid).css("height",ph+'px');
3192               $("#element"+thisElement.elementid).css("left",myModule.left2pix(thisElement.left)+'px')
3193               thisElement.filesource="/teksten/"+textid+".png";
3194          }
3195          myModule.setCurrentProps();
3196          myModule.updateprops();
3197          thisElement.visibleElement=$("#element"+thisElement.elementid);
3198          thisElement.setTransparency();
3199          selectwindow.attachToElement(thisElement)
3200          if(typeof(circleflag)!="undefined") {
3201               if(circleflag===1) {
3202                    showrealcircle();
3203                    $("#v3dialogsmall").hide();
3204               } else {
3205                    myModule.hideDialog();
3206               }
3207          } else {
3208               myModule.hideDialog();
3209          }
3210     }
3211     this.replaceClip=function replaceClip(hwratio,clipid) {
3212          myModule.hideDialog();
3213          thisElement.hwRatio=hwratio;
3214          thisElement.hwRatioOriginal=hwratio;
3215          //thisElement.libraryID=clipid;
3216          var lh=myModule.pxhoogte/2;
3217          $("#element"+thisElement.elementid).html("<img draggable='false' class='v3qrclass' src='/teksten/clip"+clipid+".png' id='elementimage"+thisElement.elementid+"' >");
3218          var pb=myModule.size2pix(thisElement.width);
3219          var ph=myModule.size2pix(thisElement.height);
3220          $("#element"+thisElement.elementid).css("width",pb+'px');
3221          $("#element"+thisElement.elementid).css("height",ph+'px');
3222          thisElement.filesource="/teksten/clip"+clipid+".png";
3223          myModule.setCurrentProps();
3224          myModule.updateprops();
3225          selectwindow.attachToElement(thisElement)
3226          myModule.currentElement=thisElement;
3227          if(thisElement.isdroptarget==1) {
3228               thisElement.setAsDroptarget(true);
3229          }
3230
3231     }
3232     this.repositionElement=function repositionElement() {
3233          var tp=myModule.top2pix(this.top);
3234          var lf=myModule.left2pix(this.left);
3235          var wi=myModule.size2pix(this.width);
3236          var he=myModule.size2pix(this.height);
3237          this.visibleElement.css("top",tp+"px")
3238          this.visibleElement.css("left",lf+"px")
3239          this.visibleElement.css("width",wi+"px")
3240          this.visibleElement.css("height",he+"px")
3241     }
3242     this.repositionElement2=function repositionElement2(ve) {
3243          if(ve) {
3244               var tp=myModule.top2pix(this.top);
3245               var lf=myModule.left2pix(this.left);
3246               var wi=myModule.size2pix(this.width);
3247               var he=myModule.size2pix(this.height);
3248               ve.css("top",tp+"px")
3249               ve.css("left",lf+"px")
3250               ve.css("width",wi+"px")
3251               ve.css("height",he+"px")
3252          }
3253     }
3254     this.repositionElementNew=function repositionElementNew() {
3255          var tp=myModule.top2pix(this.top);
3256          var lf=myModule.left2pix(this.left);
3257          var wi=myModule.size2pix(this.width);
3258          var he=myModule.size2pix(this.height);
3259          $(this.visibleElement).css("transform", 'translate('+lf+'px,'+tp+'px)');
3260     }
3261     this.setCropvalues=function setCropvalues(marginTop,marginRight,marginBottom,marginLeft,cropID,cropRotation) {
3262          this.picWidth=parseFloat(this.width)/(1-parseFloat(this.marginleft)-parseFloat(this.marginright));
3263          this.picHeight=parseFloat(this.height)/(1-parseFloat(this.margintop)-parseFloat(this.marginbottom));
3264          this.margintop=parseFloat(marginTop);
3265          this.marginright=parseFloat(marginRight);
3266          this.marginbottom=parseFloat(marginBottom);
3267          this.marginleft=parseFloat(marginLeft);
3268          delcropid=false;
3269          if(cropID==0 && this.cropID!=0) {
3270               delcropid=true;
3271          }
3272          this.cropID=cropID;
3273          this.cropRotation=cropRotation;
3274          myModule.changeElementRotationFromBox(cropRotation);
3275          var xml="postdata=<?xml version='1.0'?><root>";
3276          if(cropID==0&&cropRotation==0&&!delcropid&&this.colorname.substr(0,1)!="E") {
3277               this.cropPic()
3278          } else {
3279               var thistype=this.elementtype
3280               if(this.elementtype=="4") {
3281                    thistype=10
3282               }
3283               xml+="<uploadID>"+this.uploadID+"</uploadID>";
3284               xml+="<cropID>"+this.cropID+"</cropID>";
3285               xml+="<margintop>"+this.margintop+"</margintop>";
3286               xml+="<marginright>"+this.marginright+"</marginright>";
3287               xml+="<marginbottom>"+this.marginbottom+"</marginbottom>";
3288               xml+="<marginleft>
3288"+this.marginleft+"</marginleft>";
3289               xml+="<cropRotation>"+this.cropRotation+"</cropRotation>";
3290               xml+="<filename>"+this.filesource+"</filename>";
3291               xml+="<elementtype>"+this.elementtype+"</elementtype>";
3292               xml+="<libraryID>"+this.libraryID+"</libraryID>";
3293               xml+="<color>"+this.colorname+"</color>";
3294               xml+="<useoutline>"+this.useOutline+"</useoutline>";
3295               xml+="<outlinecolor>"+this.outlinecolorname+"</outlinecolor>";
3296               xml+="<outlinewidth>"+this.outlinewidth+"</outlinewidth>";
3297               if(this.effect.hasEffect()) {
3298                    xml+="<haseffect>1</haseffect>";
3299                    xml+=this.effect.toXML();
3300               } else {
3301                    xml+="<haseffect>0</haseffect>";
3302               }
3303               xml+="</root>";
3304               $.ajax({
3305				type: "POST",
3306				dataType: "xml",
3307				Content_type:"text/html; charset=utf-8",
3308				data: xml,
3309				cache: false,
3310				url: "/123v3/crop.p
3310hp",
3311				success: function(xml) {
3312                         thisElement.startwaitloop(thistype,$(xml).find("cropid").text())
3313                    }
3314               });
3315          }
3316     }
3317     this.setCropvalues2=function setCropvalues2(marginTop,marginRight,marginBottom,marginLeft) {
3318          this.picWidth=parseFloat(this.width)/(1-parseFloat(this.marginleft)-parseFloat(this.marginright));
3319          this.picHeight=parseFloat(this.height)/(1-parseFloat(this.margintop)-parseFloat(this.marginbottom));
3320          this.margintop=parseFloat(marginTop);
3321          this.marginright=parseFloat(marginRight);
3322          this.marginbottom=parseFloat(marginBottom);
3323          this.marginleft=parseFloat(marginLeft);
3324          this.cropPic2()
3325     }
3326
3327     this.cropPic=function cropPic(multicopy) {
3328     	multicopy=multicopy||0;
3329          myModule.hideDialog();
3330          var nw=1-this.marginright-this.marginleft;
3331          var npw=100/nw;
3332          var ml=-this.marginleft*100/nw;
3333          var nh=1-this.marginbottom-this.margintop;
3334          var nph=100/nh;
3335          var mt=-this.margintop*100/nh;
3336          this.width=this.picWidth*nw;
3337          this.height=this.picHeight*nh;
3338          this.hwRatio=this.height/this.width;
3339          if(this.cropimg.length>0) {
3340               $(this.visibleElement).children().first().attr("src","");
3341               $(this.visibleElement).children().first().attr("src",this.cropimg);
3342          }
3343          if(false){//(this.effect.hasCropEffect()) {
3344               this.visibleElementPic.css("width","100%");
3345               this.visibleElementPic.css("left","0");
3346               this.visibleElementPic.css("height","100%");
3347               this.visibleElementPic.css("top","0");
3348          } else {
3349               this.visibleElementPic.css("width",npw+"%");
3350               this.visibleElementPic.css("left",ml+"%");
3351               this.visibleElementPic.css("height",nph+"%");
3352               this.visibleElementPic.css("top",mt+"%");
3353          }
3354          this.repositionElement();
3355          if(multicopy!=1){
3356          	selectwindow.attachToElement(thisElement);
3357	          myModule.setCurrentProps();
3358	          myModule.updateprops();
3359	     }
3360     }
3361     this.cropPic2=function cropPic2() {
3362          var nw=1-this.marginright-this.marginleft;
3363          var npw=100/nw;
3364          var ml=-this.marginleft*100/nw;
3365          var nh=1-this.marginbottom-this.margintop;
3366          var nph=100/nh;
3367          var mt=-this.margintop*100/nh;
3368          this.hwRatio=this.height/this.width;
3369          if(this.cropimg.length>0) {
3370               $(this.visibleElement).children().first().attr("src","");
3371               $(this.visibleElement).children().first().attr("src",this.cropimg);
3372          }
3373          this.visibleElementPic.css("width",npw+"%");
3374          this.visibleElementPic.css("left",ml+"%");
3375          this.visibleElementPic.css("height",nph+"%");
3376          this.visibleElementPic.css("top",mt+"%");
3377          this.repositionElement();
3378          selectwindow.attachToElement(thisElement)
3379          myModule.setCurrentProps();
3380          myModule.updateprops();
3381     }
3382     this.cropPicOpen=function cropPicOpen() {
3383          var nw=1-this.marginright-this.marginleft;
3384          var npw=100/nw;
3385          var ml=-this.marginleft*100/nw;
3386          var nh=1-this.marginbottom-this.margintop;
3387          var nph=100/nh;
3388          var mt=-this.margintop*100/nh;
3389          this.hwRatio=this.height/this.width;
3390          if(false){//(this.effect.hasCropEffect()) {
3391               this.visibleElementPic.css("width","100%");
3392               this.visibleElementPic.css("left","0");
3393               this.visibleElementPic.css("height","100%");
3394               this.visibleElementPic.css("top","0");
3395          } else {
3396               this.visibleElementPic.css("width",npw+"%");
3397               this.visibleElementPic.css("left",ml+"%");
3398               this.visibleElementPic.css("height",nph+"%");
3399               this.visibleElementPic.css("top",mt+"%");
3400          }
3401          if(this.cropimg.length>0) {
3402               this.visibleElementPic.attr("src","");
3403               this.visibleElementPic.attr("src",this.cropimg);
3404          }
3405          myModule.updateprops();
3406
3407     }
3408     this.replaceUploadpic=function(filename, uploadid, uploadwidth,uploadheight,v3pixResX,v3pixResY){
3409     	myModule.currentElement=this;
3410     	$("#dropspinner"+this.elementid).hide()
3411 		var ulratio=uploadwidth/uploadheight;
3412		var thisratio=this.width/this.height
3413     	var image=uploadid+filename+'.png';
3414          this.uploadID=uploadid;
3415          this.image=image;
3416          this.filesource="/clientfiles/"+image;
3417          $(this.visibleElement).children().first().attr("src","");
3418          $(this.visibleElement).children().first().attr("src",this.filesource);
3419          this.visibleElementPic.css("width","100%");
3420          this.visibleElementPic.css("left","0");
3421          this.visibleElementPic.css("height","100%");
3422          this.visibleElementPic.css("top","0");
3423          this.marginleft=0;
3424          this.marginright=0;
3425          this.margintop=0;
3426          this.marginbottom=0;
3427		if(ulratio>=thisratio){
3428			var newheight=this.height;
3429			var newwidth=this.height*uploadwidth/uploadheight;
3430			console.log(this.width+'|'+newwidth)
3431			var origwidth=this.width;
3432			this.width=newwidth;
3433			var pw=myModule.size2pix(newwidth);
3434			this.visibleElement.css("width",pw+"px");
3435			deltax=(newwidth-origwidth)/2
3436			var dx=myModule.left2pix(this.left);
3437			var xmargin=(newwidth-origwidth)/(newwidth*2);
3438			console.log(xmargin)
3439			marginTop=0;
3440			marginBottom=0;
3441			marginLeft=xmargin;
3442			marginRight=xmargin;
3443			cropID=this.cropID;
3444			cropRotation=0;
3445			this.oWidth=uploadwidth;
3446			this.oHeight=uploadheight;
3447			this.setCropvalues(marginTop,marginRight,marginBottom,marginLeft,cropID,cropRotation) 
3448		}else{
3449			var newwidht=this.widht;
3450			var newheight=this.width*uploadheight/uploadwidth;
3451			console.log(this.height+'|'+newheight)
3452			var origheight=this.height;
3453			this.height=newheight;
3454			var ph=myModule.size2pix(newheight);
3455			this.visibleElement.css("height",ph+"px");
3456			deltay=(newheight-origheight)/2
3457			var xmargin=(newheight-origheight)/(newheight*2);
3458			console.log(xmargin)
3459			marginTop=xmargin;
3460			marginBottom=xmargin;
3461			marginLeft=0;
3462			marginRight=0;
3463			cropID=this.cropID;
3464			cropRotation=0;
3465			this.oWidth=uploadwidth;
3466			this.oHeight=uploadheight;
3467			this.setCropvalues(marginTop,marginRight,marginBottom,marginLeft,cropID,cropRotation) 
3468			
3469		}
3470    	
3471     }
3472     this.replaceUploadpic2=function replaceUploadpic(filename, uploadid, uploadwidth,uploadheight,v3pixResX,v3pixResY){
3473     	console.log("replacing upload "+uploadid)
3474     	var image=uploadid+filename+'.png';
3475          this.uploadID=uploadid;
3476          this.image=image;
3477          this.filesource="/clientfiles/"+image;
3478		var ulratio=uploadwidth/uploadheight;
3479		var thisratio=this.width/this.height
3480		if(ulratio>=thisratio){
3481			this.marginbottom=0;
3482			this.margintop=0;
3483			var newheight=this.height;
3484			var newwidth=this.height*uploadwidth/uploadheight;
3485			this.oWidth=uploadwidth;
3486			this.oHeight=uploadheight;
3487			var xmargin=(newwidth-this.width)/this.width
3488			xmargin=1-xmargin;
3489			console.log(xmargin)
3490			this.marginleft=xmargin;
3491			this.marginright=xmargin;
3492		}else{
3493			this.marginleft=0;
3494			this.marginright=0;
3495			var newwidth=this.width;
3496			
3497		}
3498          this.pixResX=v3pixResX;
3499          this.pixResY=v3pixResY;
3500          this.picWidth=this.width*(1+this.marginleft+this.marginright);
3501          this.picHeight=this.height*(1+this.margintop+this.marginbottom);
3502          this.cropimg=this.filesource;
3503          this.cropPic2();
3504          this.setTransform();
3505          this.setPropdiv();
3506          myModule.currentElement=this;
3507          myModule.setCurrentProps();
3508          myModule.updateprops();
3509          this.setTransparency();
3510     }
3511    this.replaceUploadbgremove=function replaceUploadbgremove(filename, uploadid, uploadwidth,uploadheight,v3pixResX,v3pixResY,emptybackground,backgroundtype){
3512    		emptybackground=emptybackground||0;
3513    		backgroundtype=backgroundtype||0;
3514    		console.log("backgroundtype:"+backgroundtype)
3515     	var image=uploadid+filename+'.png';
3516     	if(emptybackground==1){
3517     		this.effect.replacedbackgroundid=0;
3518     		this.effect.replacedbackgroundtype=0;
3519     	}else{
3520     		this.effect.replacedbackgroundid=this.uploadID;
3521     		this.effect.replacedbackgroundtype=backgroundtype;
3522     	}
3523          this.uploadID=uploadid;
3524          this.image=image;
3525          this.filesource="/clientfiles/"+image;
3526		var ulratio=uploadwidth/uploadheight;
3527		var thisratio=this.width/this.height
3528		var newwidth=this.width;
3529			
3530          this.pixResX=v3pixResX;
3531          this.pixResY=v3pixResY;
3532          this.oWidth=uploadwidth;
3533          this.oHeight=uploadheight;
3534          this.picWidth=this.width*(1+this.marginleft+this.marginright);
3535          this.picHeight=this.height*(1+this.margintop+this.marginbottom);
3536          this.cropimg=this.filesource;
3537          this.cropPic2();
3538          this.setTransform();
3539          myModule.currentElement=this;
3540          myModule.setCurrentProps();
3541          myModule.updateprops();
3542          this.setTransparency();
3543          myModule.setUndoInfo(36,3)
3544     }
3545     this.setPropdiv=function setPropdiv() {
3546          var div="<div class='propdiv' id='propdiv"+this.elementid+"' onclick='myModule.clickProp(this)'>";
3547          div+="	<div class='lockinfo admin' id='admininfo"+this.elementid+"'></div>";
3548          div+="	<div class='lockinfo knife' id='knifeinfo"+this.elementid+"'></div>";
3549          div+="	<div class='lockinfo locked' id='lockinfo"+this.elementid+"'></div>";
3550          div+="	<div class='lockinfo pinned' id='pininfo"+this.elementid+"'></div>";
3551          div+="	<div class='lockinfo nonprinting' id='noprintinfo"+this.elementid+"'></div>";
3552          div+="	<div class='lockinfo hideprops' id='hidepropsinfo"+this.elementid+"'></div>";
3553          div+="	<div class='seriesinfo' id='seriesinfo"+this.elementid+"'></div>";
3554          div+="	<div class='v3elementIcon2' id='propicon"+this.elementid+"'></div>";
3555          div+="	<div class='v3elementsection' id='elementsectionText'>";
3556          div+="		<div class='v3elementpropimage' id=prtext"+this.elementid+">&nbsp;</div>";
3557          div+="	</div>"
3558               div+="	<div class='v3elementsection' id='elementsectionSize'>";
3559          div+="		<div class='designpropcaptions' >";
3560          div+="			<div class='propertypropcaption'>"+$("#epwidthcaption").text()+"</div>";
3561          div+="			<div class='propertypropcaption'>"+$("#epheightcaption").text()+"</div>";
3562          div+="		</div>";
3563          div+="		<div class='elementpropvalues'>";
3564          div+="			<div class='designpropvalue' id=prwidth"+this.elementid+"></div>";
3565          div+="			<div class='designpropvalue' id=prheight"+this.elementid+"></div>";
3566          div+="		</div>";
3567          div+="	</div>";
3568          if(myModule.designtype==3||myModule.designtype==5) {
3569               div+="	<div class='v3elementsection' id='elementsectionPosition' style='display:none;'>";
3570          } else {
3571               div+="	<div class='v3elementsection' id='elementsectionPosition'>";
3572          }
3573          div+=" 		<div class='designpropcaptions'>";
3574          div+="			<div class='propertypropcaption'>"+$("#epxcaption").text()+"</div>";
3575          div+="			<div class='propertypropcaption'>"+$("#epycaption").text()+"</div>";
3576          div+="		</div>"
3577               div+="		<div class='elementpropvalues'>";
3578          div+="			<div class='designpropvalue' id=prx"+this.elementid+"></div>";
3579          div+="			<div class='designpropvalue' id=pry"+this.elementid+"></div>";
3580          div+="		</div>";
3581          div+="	</div>";
3582          if(this.hasColor==1) {
3583               div+="	<div class='v3elementsection' id='elementsectionColor'>";
3584               div+="		<div class='propertycaption' id='prreaddability'>"+$("#colorcaption").text()+"</div>";
3585               div+="		<div id='cp"+this.elementid+"' class='colorpickerbg v3nopointer'>";
3586               div+=				"<div  id='cpc"+this.elementid+"' class='colorpicker' data-colorname='S02'></div>";
3587               div+="		</div>";
3588               div+="	</div>";
3589          }
3590          if(this.elementtype==2) {
3591               div+="	<div class='v3elementsection' id='elementsectionLetterheight'>";
3592               div+="		<div class='propertycaption' id='prlh'>"+$("#lhcaption").text()+"</div>";
3593               div+="		<div class='designpropvalue' id=prlh"+this.elementid+"></div>";
3594               div+="	</div>"
3595                    div+="	<div class='v3elementsection' id='elementsectionFont'>";
3596               div+="		<div class='propertycaption' id='prfont'>"+$("#fontcaption").val()+"</div>";
3597               div+="		<div class='designpropvalue elementpropfont' id=prfont"+this.elementid+">"+this.fontdisplayname+"</div>";
3598               div+="	</div>"
3599                    // div+="	<div class='v3elementsection' id='elementsectionAlignment'>";
3600                    // div+="		<div class='propertycaption' id='pralignment'>"+$("#alignmentcaption").text()+"</div>";
3601                    // div+="		<div class='designpropvalue elementpropAlignment"+this.alignment+"' id=pralignment"+this.elementid+">&nbsp;</div>";
3602                    // div+="	</div>"
3603                    // div+="	<div class='v3elementsection' id='elementsectionAlignment'>";
3604                    // div+="		<div class='propertycaption' id='prreaddability'>"+$("#readabilitycaption").text()+"</div>";
3605                    // div+="		<div class='designpropvalue' id=prreadability"+this.elementid+">&nbsp;</div>";
3606                    // div+="	</div>"
3607          }
3608          if(this.elementtype==5) {
3609               div+="	<div class='v3elementsection' id='elementsectionQrQuality' style='display:none'>";
3610               div+="		<div class='propertycaption' id='prqrquality'>"+$("#qrqualitycaption").text()+"</div>";
3611               div+="		<div class='designpropvalue elementpropqrquality' id=pruploadresolution"+this.elementid+">"+this.qualitylevel+"</div>";
3612               div+="	</div>"
3613                    div+="	<div class='v3elementsection' id='elementsectionQrtext'>";
3614               div+="		<div class='propertycaption' id='prqrtext'>"+$("#qrtextcaption").text()+"</div>";
3615               div+="		<div class='designpropvalue elementpropqrquality' id=prqrtext"+this.elementid+">"+this.protocol+this.text+"</div>";
3616               div+="	</div>"
3617
3618          }
3619          if(this.elementtype==3) {
3620               if(this.pixResX>0) {
3621                    var currentResX=this.pixResX * this.oWidth/this.width;
3622                    var visibiltydistance=7600/currentResX;
3623                    visibiltydistance=visibiltydistance.toFixed(0);
3624                    div+="	<div class='v3elementsection' id='elementsectionUploadResolution'>";
3625                    div+="		<div class='propertycaption' id='pruploadresolution'>"+$("#uploadresolutioncaption").text()+"</div>";
3626                    div+="		<div class='designpropvalue elementpropqrquality' id=pruploadresolution"+this.elementid+">"+visibiltydistance+"</div>";
3627                    div+="	</div>"
3628                         div+="	<div class='v3elementsection' id='elementsectionUploadFilename'>";
3629                    div+="		<div class='propertycaption' id='pruploadresolution'>"+$("#uploadfilenamecaption").text()+"</div>";
3630                    div+="		<div class='designpropvalue elementpropqrquality' id=pruploadfilename"+this.elementid+">"+this.image.substr(0,this.image.length-4)+"</div>"
3631                         div+="	</div>"
3632               }
3633          }
3634          div+="	<div class='v3elementsection' id='elementsectionzindex'>";
3635          div+="		<div class='v3propbutton narrow'><div id='v3propbuttonup' data-elementid='"+this.elementid+"' onclick='myModule.setUndoInfo(13,"+this.elementtype+");myModule.moveUp(this)'>&nbsp;</div></div>";
3636          div+="		<div class='v3propbutton narrow'><div id='v3propbuttontop' data-elementid='"+this.elementid+"' onclick='myModule.setUndoInfo(13,"+this.elementtype+");myModule.moveToTop(this)'>&nbsp;</div></div>";
3637          div+="		<div class='v3propbutton narrow' ><div id='v3propbuttondown' data-elementid='"+this.elementid+"' onclick='myModule.setUndoInfo(13,"+this.elementtype+");myModule.moveDown(this)'>&nbsp;</div></div>";
3638          div+="		<div class='v3propbutton narrow' ><div id='v3propbuttonbottom' data-elementid='"+this.elementid+"' onclick='myModule.setUndoInfo(13,"+this.elementtype+");myModule.moveToBottom(this)'>&nbsp;</div></div>";
3639          div+="		<div class='v3propbutton' ><div id='v3propbuttondelete' data-elementid='"+this.elementid+"' onclick=myModule.showDialogsmall('delete')>&nbsp;</div></div>";
3640          div+="	</div>"
3641
3642          div+="	</div>";
3643          div+="</div>"
3644          $(div).insertAfter($("#elementListTitle"));
3645          this.propdiv=$("#propdiv"+this.elementid);
3646          switch(this.elementtype) {
3647          case 1:
3648               $("#propicon"+this.elementid).addClass("shapeicon");
3649               break;
3650          case 2:
3651               $("#propicon"+this.elementid).addClass("texticon");
3652               break;
3653          case 3:
3654               if(this.is123rf==1) {
3655                    $("#propicon"+this.elementid).addClass("rficon");
3656               } else {
3657                    $("#propicon"+this.elementid).addClass("uploadicon");
3658               }
3659               break;
3660          case 4:
3661               $("#propicon"+this.elementid).addClass("libicon");
3662               break;
3663          case 5:
3664               $("#propicon"+this.elementid).addClass("qricon");
3665               break;
3666          }
3667          
3668          if(this.locked==1) {
3669               $("#lockinfo"+this.elementid).addClass("active");
3670          }
3671          if(this.pintoback==1){
3672          	$("#pininfo"+this.elementid).addClass("pintoback active");
3673          }
3674          if(this.zorder==1||this.zorder==2) {
3675               $("#pininfo"+this.elementid).addClass("active");
3676          }
3677          if(this.nonprinting==1) {
3678               $("#noprintinfo"+this.elementid).addClass("active");
3679          }
3680          if(this.hideprops==1) {
3681               $("#hidepropsinfo"+this.elementid).addClass("active");
3682               if($("#elementAdminbtn").length==0) {
3683                    $(this.propdiv).css("display","none");
3684               }
3685          }
3686          if(this.kisscuts>0 || this.diecuts>0 || this.placeascutting==1) {
3687               if($("#elementAdminbtn").length) {
3688                    $("#knifeinfo"+this.elementid).addClass("active");
3689               }
3690          }
3691          if(this.seriesLetter>0) {
3692               $("#seriesinfo"+this.elementid).addClass("active");
3693               $("#seriesinfo"+this.elementid).addClass('t'+this.seriesType);
3694          }
3695          if($("#elementAdminbtn").length) {
3696               if(this.locked==1||this.zorder==1||this.zorder==2||this.kisscuts>0 || this.diecuts>0||this.elementprice>0||this.orderprice>0||this.memo.length>0||this.nonprinting==1||this.hideprops==1||this.placeascutting==1) {
3697                    $("#admininfo"+this.elementid).addClass("active");
3698               }
3699          }
3700          myModule.setPickerColor("cp"+this.elementid,this.colorname);
3701          $('.propdiv').removeClass('activeprop');
3702          $(this.propdiv).addClass("activeprop")
3703          if(myModule.elementsCollapsed) {
3704               $(this.propdiv).addClass("collapsed")
3705          }
3706          this.breedte=$("#prwidth"+this.elementid);
3707          this.hoogte=$("#prx"+this.elementid);
3708          this.x=$("#pry"+this.elementid);
3709          if(myModule.designtype==3||myModule.designtype==5) {
3710               $("#cpc"+this.elementid).hover(
3711               function() {
3712                    myModule.showtip(this);
3713               },function() {
3714                    myModule.hidetip(this);
3715               }
3716               );
3717          }
3718     }
3719     this.fitsvg=function fitsvg() {
3720          var im = $("#element"+this.elementid).children().first();
3721          im.attr("width","100%");
3722          im.attr("height","100%");
3723          this.colorchanges=0;
3724          myModule.changecolor(this.elementid);
3725     }
3726     this.setTransparency=function setTransparency() {
3727          var opacity=1-this.effect.transparency/100;
3728          if(myModule.elementtransparency>0) {
3729               var tr=(100-myModule.elementtransparency)*this.effect.transparency/100
3730                      tr+=myModule.elementtransparency;
3731               //opacity=1-tr/100;
3732          }
3733          this.visibleElement.css("opacity",opacity);
3734     }
3735     this.setTransparencyVal=function setTransparencyVal(val) {
3736          this.effect.transparency=val;
3737          this.setTransparency()
3738     }
3739     this.setAsDroptarget=function setAsDroptarget(skiptext) {
3740          skiptext=skiptext || false;
3741          if(!skiptext) {
3742               $("<div class='droptarget' id='droptarget1"+this.elementid+"'><div class='droptargettext'></div></div>").appendTo($("#element"+this.elementid));
3743          }
3744          $("<div class='dropspinner' id='dropspinner"+this.elementid+"'><div class='dropspin'><img draggable='false' src='/gfx/transparentspinner.gif'></div></div>").appendTo($("#element"+this.elementid));
3745          if($("#droptarget"+this.elementid).length==0){
3746	          var dropz=this.zindex+500;
3747	          $("<div id='droptarget"+this.elementid+"' class='v3droptarget' style='z-index:"+dropz+";width:10px;height:10px'></div>").insertAfter($("#v3buttonlayer"));
3748	          var v3fileselect=document.getElementById("droptarget"+this.elementid);
3749	          var elid=this.elementid
3750	          v3fileselect.ondrop=function(event) {
3751	               myModule.handleDrop(event,elid)
3752	          };
3753	          v3fileselect.ondragover=function(event) {
3754	               myModule.handledragOver(event,elid)
3755	          };
3756	          v3fileselect.ondragleave=function(event) {
3757	               myModule.handledragLeave(event,elid)
3758	          };
3759	     }
3760          $("#element"+this.elementid).data("tiplocation","1");
3761          $("#element"+this.elementid).data("tooltip","sleep je (foto) bestand hiernaartoe");
3762          $("#element"+this.elementid).hover(function(){myModule.showtip(this)},function(){myModule.hidetip()})
3763     }
3764     this.positiondroptarget=function positiondroptarget(){
3765     	var dt=$("#droptarget"+this.elementid);
3766     	var w=myModule.size2pix(this.width);
3767     	var h=myModule.size2pix(this.height);
3768     	var l=myModule.left2pix(this.left);
3769     	var t=myModule.top2pix(this.top);
3770     	dt.css("width",w+"px");
3771     	dt.css("height",h+"px");
3772     	dt.css("left",l+"px");
3773     	dt.css("top",t+"px");
3774     	dt.show();
3775     }
3776     this.handleDrop=function handleDrop(e) {
3777          var files = e.target.files || e.dataTransfer.files;
3778          if(files.length>1) {
3779
3780          } else {
3781               e.preventDefault();
3782               e.stopPropagation();
3783               var file=files[0];
3784               var fname=file.name;
3785               var fname=file.name.split('.');
3786               var ext=fname[fname.length-1]	;
3787               if((this.inArrayCaseInsensitive(ext,myModule.extensions)>-1 || $("#elementAdminbtn").length>=1) && file.size <= myModule.maxfilesize) {
3788                    $("#droptarget"+thisElement.elementid).hide();
3789                    $("#dropspinner"+thisElement.elementid).show();
3790                    var xhr = new XMLHttpRequest();
3791                    xhr.open("POST", "/123v3/fileupload.php?designtype="+myModule.designtype, true);
3792                    xhr.setRequestHeader("X-FILENAME", file.name);
3793                    xhr.setRequestHeader("X_RND", $("#randomnr").val());
3794                    xhr.send(file);
3795                    xhr.onreadystatechange = function() {
3796                         if (xhr.readyState == 4) {
3797
3798                              a=xhr.responseText
3799                              thisElement.elementuploadID=$(a).find("id").text();
3800				          if(thisElement.v3uploadtimer>0){
3801				          	clearInterval(thisElement.v3uploadtimer)
3802				          }
3803
3804                              thisElement.v3uploadtimer=window.setInterval(function() {
3805                              	thisElement.getanalysis()
3806                              }, 1000);
3807                         }
3808                    }
3809               }
3810          }
3811     }
3812     this.getanalysis=function getanalysis() {
3813          var xm='postdata=<root><elementType>3</elementType><id>'+thisElement.elementuploadID+'</id></root>';
3814          $.ajax({
3815
3816			type: "POST",
3817			dataType: "xml",
3818			data:xm,
3819			cache: false,
3820			url: "/123v3/elementready.php",
3821			success: function(xml) {
3822                    var result=$(xml).find("result").text();
3823                    if(result!="0") {
3824                         if(result=="1") {
3825                              window.clearInterval(thisElement.v3uploadtimer);
3826                              thisElement.v3uploadtimer=0;
3827                              v3uploadFile=$(xml).find("filename").text();
3828                              var uploadid=$(xml).find("id").text();
3829                              var kisscuts=$(xml).find("ulkisscuts").text();
3830                              var diecuts=$(xml).find("uldiecuts").text();
3831                              var color1='rgb(0,0,0)'
3832                              var color2='rgb(0,0,0)'
3833                              var ulHeight=Number($(xml).find("ulheight").text());
3834                              var ulWidth=Number($(xml).find("ulwidth").text());
3835                              var pixResX=Number($(xml).find("pixresx").text())
3836                              var pixResY=Number($(xml).find("pixresy").text())
3837                              var picratio=ulHeight/ulWidth;
3838                              var elementratio=thisElement.height/thisElement.width;
3839                              var bgwidth=0;
3840                              var bgheight=0;
3841                              var bgleft=0;
3842                              var bgtop=0;
3843                              if(picratio>elementratio) {
3844                                   bgwidth=1;
3845                                   bgleft=0;
3846                                   bgheight=picratio
3847                                   bgtop=0//(bgheight-1)/2*elementratio
3848
3849                              } else {
3850                                   bgheight=1*elementratio;
3851                                   bgtop=0;
3852                                   bgwidth=bgheight/picratio;
3853                                   bgleft=(bgheight-bgwidth)/2 * picratio;
3854                                   bgleft=0;
3855                              }
3856                              if(kisscuts=="0" && diecuts=="0") {
3857                              	if(thisElement.elementtype==3){
3858                              		thisElement.replaceUploadpic(v3uploadFile, thisElement.elementuploadID, ulWidth,ulHeight,pixResX,pixResY)
3859                              	}else{
3860	                                   var xml="postdata=<root><filltype>2</filltype>";
3861	                                   xml+="<libraryid>0</libraryid>";
3862	                                   xml+="<uploadid>"+thisElement.elementuploadID+"</uploadid>";
3863	                                   xml+="<filltop>"+bgtop+"</filltop>";
3864	                                   xml+="<fillleft>"+bgleft+"</fillleft>";
3865	                                   xml+="<fillwidth>"+bgwidth+"</fillwidth>";
3866	                                   xml+="<fillheight>"+bgheight+"</fillheight>";
3867	                                   xml+="<color1>"+color1+"</color1>";
3868	                                   xml+="<color2>"+color2+"</color2>";
3869	                                   xml+="<angle>0</angle>";
3870	                                   xml+="<fountaintype>0</fountaintype>";
3871	                                   xml+="</root>"
3872	                                   $.ajax({
3873									type: "POST",
3874									dataType: "xml",
3875									Content_type:"text/html; charset=utf-8",
3876									data: xml,
3877									cache: false,
3878									url: "/123v3/saveelementfill.php",
3879									success: function(xml) {
3880	                                             fillID=$(xml).find("fillID").text();
3881	                                             if(thisElement.elementtype==1) {
3882	                                                  thisElement.editShapeFilldrop(fillID);
3883	                                             }
3884	                                             if(thisElement.elementtype==4) {
3885	                                                  thisElement.editClipartFillDrop(fillID);
3886	                                             }
3887	                                        }
3888	                                   })
3889	                              }
3890                              } else {
3891                                   if($(xml).find("uladmin").text()=="1") {
3892                                        $("#v3uploadmessages").html("");
3893                                        $("#btnadd").show();
3894                                        $("#v3uploadpreview").css("background-image","url('/clientfiles/"+v3uploadID+v3uploadFile+".png')");
3895                                        var ulwidth=$(xml).find("ulwidth").text();
3896                                        var ulheight=$(xml).find("ulheight").text();
3897                                        v3uploadWidth=ulwidth;
3898                                        v3uploadHeight=ulheight;
3899                                        v3Kisscuts=$(xml).find("ulkisscuts").text();
3900                                        v3Diecuts=$(xml).find("uldiecuts").text();
3901                                        if(parseFloat(ulwidth)>parseFloat(ulheight)) {
3902                                             $("#v3uploadpreview").css("background-size","300px auto");
3903                                        } else {
3904                                             $("#v3uploadpreview").css("background-size","auto 280px");
3905                                        }
3906                                        $("#v3colopickerupload").show();
3907                                   } else {
3908                                        $("#v3uploadmessages").html("<?php moduleLE(8); ?>");
3909                                   }
3910                              }
3911                         }else if(result>=2){
3912                         	 window.clearInterval(thisElement.v3uploadtimer);
3913                         	 thisElement.v3uploadtimer=0;
3914		                    $("#droptarget"+thisElement.elementid).show();
3915		                    $("#dropspinner"+thisElement.elementid).hide();
3916
3917                         }
3918                    } else {
3919                         $("#v3uploadpgb").val($("#v3uploadpgb").val()+10);
3920                         if($("#v3uploadpgb").val()>=90) {
3921                              $("#v3uploadpgb").val(0);
3922                         }
3923                    }
3924               }
3925          });
3926
3927     }
3928     this.inArrayCaseInsensitive=function inArrayCaseInsensitive(needle, haystackArray) {
3929          //Iterates over an array of items to return the index of the first item that matches the provided val ('needle') in a case-insensitive way.  Returns -1 if no match found.
3930          var defaultResult = -1;
3931          var result = defaultResult;
3932          $.each(haystackArray, function(index, value) {
3933               if (result == defaultResult && value.toLowerCase() == needle.toLowerCase()) {
3934                    result = index;
3935               }
3936          });
3937          return result;
3938     }
3939     this.changeColor=function changeColor(col,colname,lhfactor,tooltip) {
3940          try {
3941               this.elementFillID=0;
3942               this.colorname=colname;
3943               this.color=col;
3944               this.lhfactor=lhfactor||1;
3945               this.tooltip=tooltip||"";
3946               if(myModule.designtype==3 || myModule.designtype==5) {
3947                    $(".v3foilfield").each(function() {
3948                         if($(this).data("foilname")==thisElement.colorname) {
3949                              thisElement.foilwidth=$(this).children().first().data("maxdimension");
3950                         }
3951                    })
3952               }
3953
3954               $("#cpc"+this.elementid).css("background-color",col);
3955               $("#cpc"+this.elementid).data("tooltip",tooltip);
3956               var r=230;
3957               var g=255;
3958               var b=255;
3959               if(col.indexOf("rgb")>-1) {
3960                    var col1=col.split("(")[1].split(")")[0];
3961                    col1=col1.split(",")
3962                    r=parseInt(col1[0])
3963                    g=parseInt(col1[1])
3964                    b=parseInt(col1[2])
3965               }
3966               if(colname=="Transparent") {
3967                    r=254;
3968                    g=254;
3969                    b=254;
3970
3971               }
3972               if(colname=="S02") {
3973                    if(myModule.materialcolor.length>0) {
3974                         var col1=myModule.materialcolor.split("(")[1].split(")")[0];
3975                         col1=col1.split(",")
3976                         r=parseInt(col1[0])
3977                         g=parseInt(col1[1])
3978                         b=parseInt(col1[2])
3979
3980                    }
3981               }
3982               if(this.useOutline==1) {
3983                    var col2=this.oldOutlinecolor.split("(")[1].split(")")[0];
3984                    col2=col2.split(",");
3985                    var oor=parseInt(col2[0]);
3986                    var oog=parseInt(col2[1]);
3987                    var oob=parseInt(col2[2]);
3988                    var col3=this.outlinecolor.split("(")[1].split(")")[0];
3989                    col3=col3.split(",");
3990                    var or=parseInt(col3[0]);
3991                    var og=parseInt(col3[1]);
3992                    var ob=parseInt(col3[2]);
3993                    if(this.outlinecolorname=="S02") {
3994                         if(myModule.materialcolor.length>0) {
3995                              var col1=myModule.materialcolor.split("(")[1].split(")")[0];
3996                              col1=col1.split(",");
3997                              or=parseInt(col1[0]);
3998                              og=parseInt(col1[1]);
3999                              ob=parseInt(col1[2]);
4000                         }
4001                    }
4002                    this.oldOutlinecolor=this.outlinecolor;
4003                    this.oldOutlinecolorname=this.outlinecolorname;
4004               }
4005               if(this.usesvg==1) {
4006                    var sv=document.getElementById("element"+this.elementid).firstElementChild;
4007                    sv.setAttributeNS("","preserveAspectRatio","none")
4008                    var im = $("#element"+this.elementid).children().first();
4009                    im.attr("width","100%");
4010                    im.attr("height","100%");
4011                    var fillcolor="rgb("+r+","+g+","+b+")"
4012                    if(this.useOutline==1) {
4013                         var strokecolor="rgb("+or+","+og+","+ob+")"
4014                    }
4015                    var strokewidth=0;
4016                    var style=$(im).find("style").text();
4017                    if(style.indexOf("stroke-width")>0) {
4018                         strokewidth=style.substr(style.indexOf("stroke-width")).split(";")[0].split(":")[1]
4019                    }
4020                    $(im).find("path").each(function() {
4021                         if($(this).attr("class").indexOf("str")>=0 ) {
4022                              $(this).css("stroke",strokecolor)
4023                              $(this).css("stroke-width",strokewidth)
4024                         } else {
4025                              $(this).css("fill",fillcolor)
4026                              if(r==255 && g==255 && b==255) {
4027                                   $(this).css("stroke","black");
4028                                   $(this).css("stroke-width","0.2%")
4029                              } else {
4030                                   $(this).css("stroke-width","0")
4031                              }
4032                         }
4033
4034                    })
4035                    $(im).find("polygon").each(function() {
4036                         if($(this).attr("class").indexOf("str")>=0 ) {
4037                              $(this).css("stroke",strokecolor)
4038                              $(this).css("stroke-width",strokewidth)
4039                         } else {
4040                              $(this).css("fill",fillcolor)
4041                              if(r==255 && g==255 && b==255) {
4042                                   $(this).css("stroke","black");
4043                                   $(this).css("stroke-width","0.2%")
4044                              } else {
4045                                   $(this).css("stroke-width","0")
4046                              }
4047                         }
4048
4049                    })
4050                    myModule.saveDesign(1);
4051                    if(myModule.designtype==3 || myModule.designtype==5) {
4052                         selectwindow.attachToElement(thisElement)
4053                    }
4054               } else if(this.elementtype==2 && this.effect.hasCropEffect()) {
4055                    this.editTexteffect();
4056               } else if(this.elementtype==1 && this.effect.hasCropEffect()) {
4057                    this.editShapeeffect();
4058               } else if(this.elementtype==4 && this.effect.hasCropEffect()) {
4059                    this.editClipartEffect();
4060
4061               } else {
4062                    if(this.qrlogoid>0) {
4063                         this.replaceQrDirect();
4064                    }else if(this.placeascutting>0){
4065                    	//do nothing	
4066                    
4067                    } else {
4068                         var img=document.getElementById("elementimage"+this.elementid);
4069                         $(img).on("load","");
4070                         var canvas = document.createElement("canvas");
4071                         canvas.width=img.naturalWidth;
4072                         canvas.height=img.naturalHeight;
4073                         var context = canvas.getContext('2d');
4074
4075                         context.clearRect(0, 0, canvas.width, canvas.height,img.naturalHeight*10);
4076                         context.drawImage(img, 0, 0);
4077                         var imageData = context.getImageData(0,0,canvas.width,canvas.height);
4078                         var data = imageData.data;
4079                         if(r==255 && g==255 && b==255) {
4080                              for (var y=0; y<imageData.height; y++) {
4081                                   for(var x = 0; x < imageData.width; x++) {
4082                                        var p=(y*imageData.width+x)*4
4083                                              var p1=((y-1)*imageData.width+x)*4
4084                                                     var p2=((y+1)*imageData.width+x)*4
4085                                        if(data[p+3]!=0) {
4086                                             if(data[p-1]==0||data[p+7]==0||y==0||x==0||x==imageData.width-1||y==imageData.height-1) {
4087                                                  data[p + 0] = 0;
4088                                                  data[p + 1] = 0;
4089                                                  data[p + 2] = 0;
4090                                                  data[p + 3] = 255;
4091                                             } else if(data[p1+3]==0||data[p2+3]==0) {
4092                                                  data[p + 0] = 0;
4093                                                  data[p + 1] = 0;
4094                                                  data[p + 2] = 0;
4095                                                  data[p + 3] = 255;
4096                                             } else {
4097                                                  data[p + 0] = 255;
4098                                                  data[p + 1] = 255;
4099                                                  data[p + 2] = 255;
4100                                                  data[p + 3] = 255;
4101                                             }
4102                                        }
4103                                   }
4104                              }
4105                              myModule.opstand=1;
4106                              myModule.setdesigninfo();
4107                         } else {
4108                              if(this.useOutline==1) {
4109                                   for(var p = 0, len = data.length; p < len; p+=4) {
4110                                        if(data[p+3] == 0) {
4111                                        } else {
4112                                             if(data[p+0]==oor&&data[p+1]==oog&&data[p+2]==oob) {
4113                                                  data[p + 0] = or;
4114                                                  data[p + 1] = og;
4115                                                  data[p + 2] = ob;
4116                                                  data[p + 3] = 255;
4117                                             } else {
4118                                                  data[p + 0] = r;
4119                                                  data[p + 1] = g;
4120                                                  data[p + 2] = b;
4121                                                  data[p + 3] = 255;
4122                                             }
4123                                        }
4124                                   }
4125                              } else {
4126                                   for(var p = 0, len = data.length; p < len; p+=4) {
4127                                        if(data[p+3] == 0)
4128                                             continue;
4129                                        data[p + 0] = r;
4130                                        data[p + 1] = g;
4131                                        data[p + 2] = b;
4132                                        data[p + 3] = 255;
4133                                   }
4134                              }
4135                         }
4136                         context.putImageData(imageData, 0, 0);
4137                         img.src=canvas.toDataURL();
4138                         if(thisElement.nosavepattern!=1){
4139                         	
4140                         	myModule.saveDesign(1);
4141                         	thisElement.nosavepattern=0;
4142                         }
4143                         if(myModule.designtype==3 || myModule.designtype==5) {
4144                              selectwindow.attachToElement(thisElement)
4145                         }
4146                         if(myModule.currentElement.elementid==this.elementid) {
4147                              $('#v3elementpropimage').css("background-image","url('"+$("#elementimage"+myModule.currentElement.elementid).prop("src")+"')");
4148                         }
4149                    }
4150               }
4151          }
4152          catch(err) {
4153               console.log(err.message)
4154          }
4155     }
4156     this.removeElement=function removeElement() {
4157          myModule.currentChange=18;
4158          myModule.clearSelection()
4159          $(this.visibleElement).remove();
4160          $(this.propdiv).remove();
4161          if(myModule.basicshape==5) {
4162               if (this.kisscuts>0 || this.diecuts>0) {
4163                    var kisses=0;
4164                    var dies=0;
4165                    $.each(myModule.elements,function() {
4166                         kisses+=Number(this.kisscuts);
4167                         dies+=Number(this.diecuts);
4168                    });
4169                    if(kisses==this.kisscuts && dies==this.diecuts) {
4170                         myModule.basicshape=1;
4171                         myModule.lastCutDeleted=true;
4172                    }
4173               }
4174          }
4175          myModule.closeMenu();
4176          myModule.removeElementAt(this.elementid);
4177          myModule.saveDesign(1);
4178     }
4179     this.removeElementNosave=function removeElementNosave() {
4180          myModule.clearSelection()
4181//		if(this.locked!=1||$("#elementAdminbtn").length){
4182          $(this.visibleElement).remove();
4183          $(this.propdiv).remove();
4184          myModule.closeMenu();
4185          myModule.removeElementAt(this.elementid);
4186//		}
4187     }
4188     this.moveUp=function moveUp() {
4189          myModule.currentChange=13;
4190          if(myModule.isMobile){
4191          	var previd=-1;
4192          	var thisz=this.zindex;
4193          	var curz=1000;
4194          	for (var i=0; i<myModule.elements.length; i++) {
4195          		if(myModule.elements[i].zindex>thisz){
4196          			if(myModule.elements[i].zindex<curz){
4197          				curz=myModule.elements[i].zindex;
4198          				previd=myModule.elements[i].elementid;
4199          			}
4200          		}
4201          	}
4202	          if(previd>-1) {
4203
4204	               for (var i=0; i<myModule.elements.length; i++) {
4205	                    if(myModule.elements[i].elementid==previd) {
4206
4207	                         var previndex=myModule.elements[i].zindex;
4208	                         myModule.elements[i].zindex=this.zindex;
4209	                         $(myModule.elements[i].visibleElement).css("z-index",this.zindex);
4210	                         this.zindex=previndex;
4211	                         $(this.visibleElement).css("z-index",previndex);
4212	                    }
4213	               }
4214	          }
4215          }else{
4216	          var prev=this.propdiv.prev();
4217	          var previd=prev.prop("id");
4218	          if(previd.substr(0,7)=="propdiv") {
4219	               previd=previd.substr(7)
4220
4221	               $(this.propdiv).insertBefore(prev);
4222	               for (var i=0; i<myModule.elements.length; i++) {
4223	                    if(myModule.elements[i].elementid==previd) {
4224
4225	                         var previndex=myModule.elements[i].zindex;
4226	                         myModule.elements[i].zindex=this.zindex;
4227	                         $(myModule.elements[i].visibleElement).css("z-index",this.zindex);
4228	                         this.zindex=previndex;
4229	                         $(this.visibleElement).css("z-index",previndex);
4230	                    }
4231	               }
4232	          }
4233	     }
4234          if(this.movingTopBottom==0) {
4235               myModule.ensureZorder();
4236          }
4237          myModule.saveDesign(1);
4238     }
4239     this.moveDown=function moveDown() {
4240          myModule.currentChange=13;
4241          
4242          if(myModule.isMobile){
4243          	var nextid=-1;
4244          	var thisz=this.zindex;
4245          	var curz=0;
4246          	for (var i=0; i<myModule.elements.length; i++) {
4247          		if(myModule.elements[i].zindex<thisz){
4248          			if(myModule.elements[i].zindex>
4248curz){
4249          				curz=myModule.elements[i].zindex;
4250          				nextid=myModule.elements[i].elementid;
4251          			}
4252          		}
4253          	}
4254	          if(nextid>-1) {
4255	               
4256	               for (var i=0; i<myModule.elements.length; i++) {
4257	                    if(myModule.elements[i].elementid==nextid) {
4258	                         var nextindex=myModule.elements[i].zindex;
4259	                         myModule.elements[i].zindex=this.zindex;
4260	                         $(myModule.elements[i].visibleElement).css("z-index",this.zindex);
4261	                         this.zindex=nextindex;
4262	                         $(this.visibleElement).css("z-index",nextindex);
4263	                    }
4264	               }
4265	          }
4266          }else{
4267	          var next1=this.propdiv.next();
4268	          var nextid=next1.prop("id");
4269	          if(nextid.substr(0,7)=="propdiv") {
4270	               nextid=nextid.substr(7)
4271
4272	               $(this.propdiv).insertAfter(next1);
4273	               for (var i=0; i<myModule.elements.length; i++) {
4274	                    if(myModule.elements[i].elementid==nextid) {
4275	                         var nextindex=myModule.elements[i].zindex;
4276	                         myModule.elements[i].zindex=this.zindex;
4277	                         $(myModule.elements[i].visibleElement).css("z-index",this.zindex);
4278	                         this.zindex=nextindex;
4279	                         $(this.visibleElement).css("z-index",nextindex);
4280	                    }
4281	               }
4282	          }
4283	     }
4284          if(this.movingTopBottom==0) {
4285               myModule.ensureZorder();
4286          }
4287          myModule.saveDesign(1);
4288     }
4289     this.moveToBottom=function moveToBottom() {
4290          var isBottom=true;
4291          this.movingTopBottom=1;
4292          for (var i=0; i<myModule.elements.length; i++) {
4293               if(myModule.elements[i].zindex<this.zindex) {
4294                    isBottom=false;
4295               }
4296          }
4297          if(!isBottom) {
4298               this.moveDown();
4299               this.moveToBottom();
4300          }
4301          this.movingTopBottom=0;
4302     }
4303     this.moveToTop=function moveToTop() {
4304          var isTop=true;
4305          this.movingTopBottom=1;
4306          for (var i=0; i<myModule.elements.length; i++) {
4307               if(myModule.elements[i].zindex>
4307this.zindex) {
4308                    isTop=false;
4309               }
4310          }
4311          if(!isTop) {
4312               this.moveUp();
4313               this.moveToTop();
4314          }
4315          this.movingTopBottom=0;
4316     }
4317     this.setlockinginfo=function setlockinginfo() {
4318          if(this.locked==1) {
4319               $("#lockinfo"+this.elementid).addClass("active");
4320          } else {
4321               $("#lockinfo"+this.elementid).removeClass("active");
4322          }
4323          if(this.zorder==1 || this.zorder==2) {
4324               $("#pininfo"+this.elementid).addClass("active");
4325          } else {
4326               $("#pininfo"+this.elementid).removeClass("active");
4327          }
4328          if($("#elementAdminbtn").length) {
4329               if(this.locked==1||this.zorder==1||this.zorder==2||this.kisscuts>0 || this.diecuts>0||this.elementprice>0||this.orderprice>0||this.memo.length>0||this.nonprinting==1||this.hideprops==1||this.placeascutting==1) {
4330                    $("#admininfo"+this.elementid).addClass("active");
4331               } else {
4332                    $("#admininfo"+this.elementid).removeClass("active");
4333               }
4334          } else {
4335               $("#admininfo"+this.elementid).removeClass("active");
4336          }
4337          if(this.nonprinting==1) {
4338               $("#noprintinfo"+this.elementid).addClass("active");
4339          } else {
4340               $("#noprintinfo"+this.elementid).removeClass("active");
4341
4342          }
4343          if(this.hideprops==1) {
4344               $("#hidepropsinfo"+this.elementid).addClass("active");
4345          } else {
4346               $("#hidepropsinfo"+this.elementid).removeClass("active");
4347
4348          }
4349          if(this.placeascutting==1){
4350          	$("#knifeinfo"+this.elementid).addClass("active");
4351          }else{
4352          	$("#knifeinfo"+this.elementid).removeClass("active");
4353          }
4354     }
4355     this.togglemirrorH=function togglemirrorH() {
4356          if(this.mirror==3) {
4357               this.mirror=2;
4358          } else if(this.mirror==2) {
4359               this.mirror=3;
4360          } else if(this.mirror==1) {
4361               this.mirror=0;
4362          } else {
4363               this.mirror=1;
4364          }
4365          this.setTransform();
4366     }
4367     this.togglemirrorV=function togglemirrorV() {
4368          if(this.mirror==3) {
4369               this.mirror=1;
4370          } else if(this.mirror==1) {
4371               this.mirror=3;
4372          } else if(this.mirror==2) {
4373               this.mirror=0;
4374          } else {
4375               this.mirror=2;
4376          }
4377          this.setTransform();
4378     }
4379     this.setTransform=function setTransform() {
4380          var t="rotate("+thisElement.rotation+"deg)"
4381          if(thisElement.mirror==1 || thisElement.mirror==3) {
4382               t+=" scaleX(-1)";
4383          }
4384          if(thisElement.mirror==2 || thisElement.mirror==3) {
4385               t+=" scaleY(-1)";
4386          }
4387          $("#element"+this.elementid).css("transform",t);
4388     }
4389     this.checkMaxdimension=function checkMaxdimension() {
4390          if(myModule.designtype==3 || myModule.designtype==5) {
4391               if(this.maxdimensionswarned==0) {
4392                    if(this.foilwidth>0) {
4393                         if(this.width>this.foilwidth && this.height>this.foilwidth) {
4394                              myModule.showAlert("maxdimension");
4395                              this.maxdimensionswarned=1;
4396                         }
4397                    }
4398               } else {
4399                    if(this.foilwidth>0) {
4400                         if(this.width<this.foilwidth || this.height<this.foilwidth) {
4401                              this.maxdimensionswarned=0;
4402                         }
4403                    }
4404               }
4405          }
4406     }
4407}
4408
4409
4410function effects() {
4411     this.transparency=0;
4412     this.greyscale=0;
4413     this.shadow=0;
4414     this.shadowhardnes=0;
4415     this.shadowdepth=0;
4416     this.shadowcolor='S18';
4417     this.shadowdirection=0;
4418     this.widthratio=1;
4419     this.heightratio=1;
4420     this.leftratio=0;
4421     this.topratio=0;
4422     this.blockshadow=0;
4423     this.neon=0;
4424     this.bevel=0;
4425     this.hasstyle=0;
4426     this.stylename='';
4427     this.replacedbackgroundid=0;
4428     this.replacedbackgroundtype=0;
4429     this.toXML=function toXML() {
4430          var xm="<effect>";
4431          xm+="<transparency>"+this.transparency+"</transparency>";
4432          xm+="<greyscale>"+this.greyscale+"</greyscale>";
4433          xm+="<shadow>"+this.shadow+"</shadow>";
4434          xm+="<shadowhardnes>"+this.shadowhardnes+"</shadowhardnes>";
4435          xm+="<shadowdepth>"+this.shadowdepth+"</shadowdepth>";
4436          xm+="<shadowcolor>"+this.shadowcolor+"</shadowcolor>";
4437          xm+="<shadowdirection>"+this.shadowdirection+"</shadowdirection>";
4438          xm+="<widthratio>"+this.widthratio+"</widthratio>";
4439          xm+="<heightratio>"+this.heightratio+"</heightratio>";
4440          xm+="<leftratio>"+this.leftratio+"</leftratio>";
4441          xm+="<topratio>"+this.topratio+"</topratio>";
4442          xm+="<blockshadow>"+this.blockshadow+"</blockshadow>";
4443          xm+="<neon>"+this.neon+"</neon>";
4444          xm+="<bevel>"+this.bevel+"</bevel>";
4445          xm+="<hasstyle>"+this.hasstyle+"</hasstyle>";
4446          xm+="<stylename>"+this.stylename+"</stylename>";
4447          xm+="<replacedbackgroundid>"+this.replacedbackgroundid+"</replacedbackgroundid>";
4448          xm+="<replacedbackgroundtype>"+this.replacedbackgroundtype+"</replacedbackgroundtype>";
4449          xm+="</effect>";
4450          return xm;
4451     }
4452     this.hasEffect=function hasEffect() {
4453          var h=false;
4454          if(this.transparency>0) {
4455               h=true;
4456          }
4457          if(this.shadow>0) {
4458               h=true;
4459          }
4460          if(this.greyscale>0) {
4461               h=true;
4462          }
4463          if(this.blockshadow>0) {
4464               h=true;
4465          }
4466          if(this.neon>0) {
4467               h=true;
4468          }
4469          if(this.bevel>0){
4470          	h=true;
4471          }
4472          if(this.replacedbackgroundid>0){
4473          	h=true;
4474          }
4475	     if(this.hasstyle>0 && this.stylename.length>0){
4476	     	h=true;
4477	     }
4478          return h;
4479     }
4480     this.hasCropEffect=function hasCropEffect() {
4481          var h=false;
4482          if(this.shadow>0) {
4483               h=true;
4484          }
4485          if(this.greyscale>0) {
4486               h=true;
4487          }
4488          if(this.blockshadow>0) {
4489               h=true;
4490          }
4491          if(this.neon>0) {
4492               h=true;
4493          }
4494          if(this.bevel>0){
4495          	h=true;
4496          }
4497          if(this.replacedbackgroundid>0){
4498          	h=true;
4499          }
4500          if(this.hasstyle==1 && this.stylename.length>0){
4501          	h=true;
4502          }
4503          return h;
4504     }
4505     this.countEffect=function countEffect() {
4506          var h=0;
4507          if(this.transparency>0) {
4508               h+=1;
4509          }
4510          if(this.shadow>0) {
4511               h+=1;
4512          }
4513          if(this.greyscale>0) {
4514               h+=1;
4515          }
4516          if(this.blockshadow>0) {
4517               h+=1;
4518          }
4519          if(this.neon>0) {
4520               h+=1;
4521          }
4522          if(this.bevel>0){
4523          	h+=1;
4524          }
4525          if(this.hasstyle>0){
4526          	h+=1;
4527          }
4528          if(this.replacedbackgroundid>0){
4529          	h+=1;
4530          }
4531          return h;
4532     }
4533     this.setEffect=function setEffect(xml) {
4534          this.transparency=$(xml).find("transparency").text();
4535          this.greyscale=$(xml).find("greyscale").text();
4536          this.shadow=$(xml).find("shadow").text();
4537          this.shadowhardnes=$(xml).find("shadowhardnes").text();
4538          this.shadowdepth=$(xml).find("shadowdepth").text();
4539          this.shadowcolor=$(xml).find("shadowcolor").text();
4540          this.shadowdirection=$(xml).find("shadowdirection").text();
4541          this.widthratio=$(xml).find("widthratio").text();
4542          this.heightratio=$(xml).find("heightratio").text();
4543          this.leftratio=$(xml).find("leftratio").text();
4544          this.topratio=$(xml).find("topratio").text();
4545          this.blockshadow=$(xml).find("blockshadow").text();
4546          this.neon=$(xml).find("neon").text();
4547          this.bevel=$(xml).find("bevel").text();
4548          this.hasstyle=$(xml).find("hasstyle").text();
4549          this.stylename=$(xml).find("stylename").text();
4550          this.replacedbackgroundid=$(xml).find("replacedbackgroundid").text();
4551          this.replacedbackgroundtype=$(xml).find("replacedbackgroundtype").text();
4552     }
4553     this.togglegreyscale=function togglegreyscale() {
4554          if(this.greyscale==1) {
4555               this.greyscale=0;
4556               $("#sweffectgreyscale").removeClass("swon");
4557               $("#fxstategreyscale").removeClass("on");
4558          } else {
4559               this.greyscale=1;
4560               $("#sweffectgreyscale").addClass("swon");
4561               $("#fxstategreyscale").addClass("on")
4562          }
4563          $("#sweffectgreyscale").hide();
4564          $("#mnueffect").hide();
4565          myModule.currentElement.editUploadEffect();
4566          myModule.setCurrentProps();
4567          myModule.saveDesign(1);
4568          myModule.setUndoInfo(33,myModule.currentElement.elementtype);
4569     }
4570     this.toggleneon=function toggleneon() {
4571          if(this.neon==1) {
4572               this.neon=0;
4573               $("#sweffectneon").removeClass("swon");
4574               $("#fxstateneon").removeClass("on");
4575          } else {
4576               this.neon=1;
4577               $("#sweffectneon").addClass("swon");
4578               $("#fxstateneon").addClass("on")
4579          }
4580          $("#sweffectneon").hide();
4581          $("#mnueffect").hide();
4582          $('#mnueffectstyle').hide();
4583          myModule.setCurrentProps();
4584          myModule.saveDesign(1);
4585          myModule.setUndoInfo(34,myModule.currentElement.elementtype);
4586     }
4587     this.togglebevel=function togglebevel(slider) {
4588     	var sliderval=$(slider).val();
4589     	this.bevel=sliderval;
4590          if(this.bevel==0) {
4591               $("#sweffectbevel").removeClass("swon");
4592               $("#fxstatebevel").removeClass("on");
4593          } else {
4594               $("#sweffectbevel").addClass("swon");
4595               $("#fxstatebevel").addClass("on")
4596               this.hasstyle=0;
4597               this.stylename='';
4598               
4599          }
4600          $("#sweffectbevel").hide();
4601          $("#mnueffect").hide();
4602          $('#mnueffectstyle').hide();
4603          myModule.currentElement.editTexteffect()
4604          myModule.setCurrentProps();
4605          myModule.saveDesign(1);
4606          myModule.setUndoInfo(34,myModule.currentElement.elementtype);
4607     }
4608     this.togglestyle=function stogglestyle(stylename){
4609     	if(this.hasstyle && this.stylename==stylename){
4610     		this.hasstyle=0;
4611     		this.stylename='';
4612     	}else{
4613     		this.hasstyle=1;
4614     		this.stylename=stylename;
4615     		this.bevel=0;
4616               $("#sweffectbevel").removeClass("swon");
4617               $("#fxstatebevel").removeClass("on");
4618     		
4619     	}
4620     	$("#mnueffect").hide();
4621     	$('#mnueffectstyle').hide();
4622          myModule.setCurrentProps();
4623          myModule.saveDesign(1);
4624          myModule.setUndoInfo(34,myModule.currentElement.elementtype);
4625		if(myModule.currentElement.elementtype==1){
4626			myModule.currentElement.editShapeeffect();
4627		}else if(myModule.currentElement.elementtype==2){
4628			myModule.currentElement.editTexteffect()
4629		}else if(myModule.currentElement.elementtype==3){
4630			myModule.currentElement.editUploadEffect();
4631		}else if(myModule.currentElement.elementtype==4){
4632			myModule.currentElement.editClipartEffect();
4633		}
4634     	
4635     }
4636     this.removestyle=function removestyle(){
4637		this.hasstyle=0;
4638		this.stylename='';
4639          myModule.setCurrentProps();
4640          myModule.saveDesign(1);
4641          myModule.setUndoInfo(34,myModule.currentElement.elementtype);
4642		if(myModule.currentElement.elementtype==1){
4643			myModule.currentElement.editShapeeffect();
4644		}else if(myModule.currentElement.elementtype==2){
4645			myModule.currentElement.editTexteffect()
4646		}else if(myModule.currentElement.elementtype==3){
4647			myModule.currentElement.editUploadEffect();
4648		}else if(myModule.currentElement.elementtype==4){
4649			myModule.currentElement.editClipartEffect();
4650		}
4651     }
4652     this.setstyle=function setstyle(stylename,slider){
4653     	var sliderval=$(slider).val();
4654     	if(sliderval==0){
4655     		this.hasstyle=0;
4656     		this.stylename='';
4657     	}else{
4658     		this.hasstyle=1;
4659     		this.stylename=stylename+"_"+sliderval;
4660     		this.bevel=0;
4661               $("#sweffectbevel").removeClass("swon");
4662               $("#fxstatebevel").removeClass("on");
4663     	}
4664     	$("#mnueffect").hide();
4665     	$('#mnueffectstyle').hide();
4666          myModule.setCurrentProps();
4667          myModule.saveDesign(1);
4668          myModule.setUndoInfo(34,myModule.currentElement.elementtype);
4669		if(myModule.currentElement.elementtype==1){
4670			myModule.currentElement.editShapeeffect();
4671		}else if(myModule.currentElement.elementtype==2){
4672			myModule.currentElement.editTexteffect()
4673		}else if(myModule.currentElement.elementtype==3){
4674			myModule.currentElement.editUploadEffect();
4675		}
4675else if(myModule.currentElement.elementtype==4){
4676			myModule.currentElement.editClipartEffect();
4677		}
4678     }
4679     this.setsepia=function setsepia(slider){
4680     	var sliderval=$(slider).val();
4681     	var stylename='';
4682     	if(sliderval==1){stylename='sepia_1'}
4683     	if(sliderval==2){stylename='sepia_2'}
4684     	if(sliderval==3){stylename='sepia_3'}
4685     	if(sliderval==4){stylename='sepia_4'}
4686     	if(sliderval==0){
4687     		$("#fxstatesepia").removeClass('on');
4688     		this.hasstyle=0;
4689     	}else{
4690     		$("#fxstatesepia").addClass('on');
4691     		this.hasstyle=1;
4692     	}
4693     	this.stylename=stylename;
4694          myModule.currentElement.editUploadEffect();
4695          myModule.setCurrentProps();
4696          myModule.saveDesign(1);
4697          myModule.setUndoInfo(33,myModule.currentElement.elementtype);
4698     }
4699     this.togglebackgroundremove=function togglebackgroundremove(){
4700     	if(this.replacedbackgroundid>0){
4701			var xm='postdata=<root><elementType>3</elementType><id>'+this.replacedbackgroundid+'</id></root>';
4702			$.ajax({
4703				
4704				type: "POST",
4705				dataType: "xml",
4706				data:xm,
4707				cache: false,
4708				url: "/123v3/elementready.php",
4709				success: function(xml) {
4710					var result=$(xml).find("result").text();
4711					if(result!="0" && result!="44"){
4712						if(result=="1"){
4713					    		var v3uploadFile=$(xml).find("filename").text();
4714				    			var d=new Date();
4715				    			d=d.getTime()
4716				    			var d=new Date();
4717				    			d=d.getTime()
4718				    			var ulwidth=$(xml).find("ulwidth").text();
4719				    			var ulheight=$(xml).find("ulheight").text();
4720					    		var v3uploadWidth=ulwidth;
4721					    		var v3uploadHeight=ulheight;
4722					    		v3Kisscuts=0;
4723					    		v3Diecuts=0;
4724					    		var v3pixResX=$(xml).find("pixresx").text();
4725					    		var v3pixResY=$(xml).find("pixresy").text();
4726					    		var v3uploadID=myModule.currentElement.effect.replacedbackgroundid;
4727					    		myModule.currentElement.replaceUploadbgremove(v3uploadFile, v3uploadID, v3uploadWidth,v3uploadHeight,v3pixResX,v3pixResY);
4728					    		myModule.currentElement.effect.replacedbackgroundid=0;
4729					    	}
4730					}
4731				}
4732			});
4733     		
4734     	}else{
4735     		myModule.removebackground();
4736     	}
4737     }
4738     this.togglecartoonyourself=function togglecartoonyourself(){
4739     	if(this.replacedbackgroundid>0){
4740			var xm='postdata=<root><elementType>3</elementType><id>'+this.replacedbackgroundid+'</id></root>';
4741			$.ajax({
4742				
4743				type: "POST",
4744				dataType: "xml",
4745				data:xm,
4746				cache: false,
4747				url: "/123v3/elementready.php",
4748				success: function(xml) {
4749					var result=$(xml).find("result").text();
4750					if(result!="0" && result!="44"){
4751						if(result=="1"){
4752					    		var v3uploadFile=$(xml).find("filename").text();
4753				    			var d=new Date();
4754				    			d=d.getTime()
4755				    			var d=new Date();
4756				    			d=d.getTime()
4757				    			var ulwidth=$(xml).find("ulwidth").text();
4758				    			var ulheight=$(xml).find("ulheight").text();
4759					    		var v3uploadWidth=ulwidth;
4760					    		var v3uploadHeight=ulheight;
4761					    		v3Kisscuts=0;
4762					    		v3Diecuts=0;
4763					    		var v3pixResX=$(xml).find("pixresx").text();
4764					    		var v3pixResY=$(xml).find("pixresy").text();
4765					    		var v3uploadID=myModule.currentElement.effect.replacedbackgroundid;
4766					    		myModule.currentElement.replaceUploadbgremove(v3uploadFile, v3uploadID, v3uploadWidth,v3uploadHeight,v3pixResX,v3pixResY,0,1);
4767					    		myModule.currentElement.effect.replacedbackgroundid=0;
4768					    	}
4769					}
4770				}
4771			});
4772     		
4773     	}else{
4774     		myModule.cartoonyourself();
4775     	}
4776     }
4777     
4778}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.