home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2005 April
/
PCWorld_2005-04_cd.bin
/
novinky
/
Interval
/
podklady
/
hejral
/
1080
/
rapid
/
Js
/
tot.js
Wrap
Text File
|
2005-02-02
|
140KB
|
1 lines
SBL= { NAMESPACE: "http://www.xstreamsoftware.com/sbl" }; var nOt565 = null; var rMs885 = null; var xKw452; var mBt375; var aEm599 = "RGB(184,184,184)"; var bCe765 = "RGB(100,100,170)"; var hNt852 = "RGB(180,180,180)"; var dUr974 = "RGB(255,255,255)"; var aCv277 = "RGB(155,155,155)"; var dTp307; var iBp777; var yDx133; var iNs824; var aPs683; var rOw327; var kYn978; var tQw619; var dDx879; function loadNS(evt) { dTp307 = new Array(); iBp777 = new Array(); yDx133 = new Array(); iNs824 = new Array(); aPs683 = new Array(); rOw327 = new Array(); kYn978 = new Array(); tQw619 = new Array(); xKw452 = evt.getTarget().getOwnerDocument(); mBt375 = xKw452.rootElement; mBt375.setAttribute( "onmousemove", "drag(evt)"); mBt375.setAttribute( "onmouseup", "enddrag()"); mBt375.setAttribute( "onkeypress", "keyPress(evt)"); mBt375.setAttribute( "onkeydown", "keyDown(evt)"); var hJr478=0; var mQt326 = mBt375.getElementsByTagNameNS( SBL.NAMESPACE, "*" ); for( var t = mQt326.item(0); t; t = mQt326.item(hJr478) ) { var tagname = t.getTagName().replace(/^[^:]+:/, ""); if( tagname == "defCol") { writeDefaultColors(t); mBt375.removeChild( t); } else if( tagname == "defTitle" ) { dDx879 = "defTitle"; mBt375.removeChild( t); } else if( t.parentNode == mBt375) { var Obj = AddObj( mBt375, t); AddToArray(Obj, t.nodeName ); mBt375.removeChild( t); } else hJr478++; } var artQw619 = mBt375.getElementsByTagName( "g" ); for( var n = 0; n<artQw619.length; n++ ) { var node = artQw619.item( n); var Id = node.id; if( Id == "Local" || Id == "GlobalTop" || Id == "GlobalBtm" ) ParseToptQw619( node); else { var pRc300 = ParseGroup( node); if( pRc300 ) tQw619[ tQw619.length] = pRc300; } } if( dDx879 == "defTitle" ) writeTitle(); } function ParseToptQw619( grp) { var hJr478=0; var mQt326 = grp.getElementsByTagNameNS( SBL.NAMESPACE, "*" ); for( var t = mQt326.item(0); t; t = mQt326.item(hJr478) ) { if( t.parentNode == grp) { var Obj = AddObj( grp, t); AddToArray(Obj, t.nodeName ); grp.removeChild( t); } else hJr478++; } var artQw619 = grp.getElementsByTagName( "g" ); for( var n = 0; n<artQw619.length; n++ ) { var node = artQw619.item( n); if(node.parentNode == grp) { var pRc300 = ParseGroup( node); if( pRc300 ) tQw619[ tQw619.length] = pRc300; } } } function ParseGroup( grp) { var mQt326 = grp.getElementsByTagNameNS( SBL.NAMESPACE, "*" ); var sNa381 = new Group( grp ); var nlen = mQt326.length; if(mQt326.length > 0) { var hJr478=0; for( var t = mQt326.item(0); t; t = mQt326.item(hJr478) ) { if( t.parentNode == grp) { var Obj = AddObj( grp, t); sNa381.AddToArray(Obj, t.nodeName ); grp.removeChild( t); } else hJr478++; } } var artQw619 = grp.getElementsByTagName( "g" ); if(nlen <= 0 && artQw619.length <=0 ) return null; for( var n = 0; n<artQw619.length; n++ ) { var node = artQw619.item( n); if(node.parentNode == grp) { var pRc300 = ParseGroup( node); if( pRc300 ) sNa381.tQw619[ tQw619.length] = pRc300; } } if(sNa381.tQw619.length > 0 || nlen > 0) return sNa381; else return null; } function AddObj( parent, node) { var tagname = node.getTagName().replace(/^[^:]+:/, ""); var Obj; switch( tagname) { case 'hyperlink': Obj = new hyperlink( node, parent); break; case 'check': Obj = new hyperlink( node, parent); break; case 'radio': Obj = new hyperlink( node, parent); break; case 'insbox': Obj = new InstructionBox( node, parent); break; case 'txtfield': Obj = new textfield( node, parent); break; case 'valfield': Obj = new ValField( node, parent); break; case 'combo': Obj = new combobox( node, parent); break; case 'chart': Obj = new Chart( node, parent); break; } return Obj; } function AddToArray( Obj, tagname) { var tagname = tagname.replace(/^[^:]+:/, ""); switch( tagname) { case 'hyperlink': dTp307[dTp307.length] = Obj; break; case 'check': iBp777[iBp777.length] = Obj; break; case 'radio': yDx133[yDx133.length] = Obj; break; case 'insbox': rOw327[rOw327.length] = Obj; break; case 'txtfield': aPs683[aPs683.length] = Obj; break; case 'valfield': iNs824[iNs824.length] = Obj; break; case 'combo': kYn978[kYn978.length] = Obj; break; } } function Group( node) { this.node = node; this.dTp307 = new Array(); this.iBp777 = new Array(); this.yDx133 = new Array(); this.iNs824 = new Array(); this.aPs683 = new Array(); this.rOw327 = new Array(); this.kYn978 = new Array(); this.tQw619 = new Array(); }; Group.prototype.AddToArray = function( Obj, tagname) { var tagname = tagname.replace(/^[^:]+:/, ""); switch( tagname) { case 'hyperlink': this.dTp307[this.dTp307.length] = Obj; break; case 'check': this.iBp777[this.iBp777.length] = Obj; break; case 'radio': this.yDx133[this.yDx133.length] = Obj; break; case 'insbox': this.rOw327[this.rOw327.length] = Obj; break; case 'txtfield': this.aPs683[this.aPs683.length] = Obj; break; case 'valfield': this.iNs824[this.iNs824.length] = Obj; break; case 'combo': this.kYn978[this.kYn978.length] = Obj; break; } }; function writeTitle() { var tit = createNode( "text", mBt375, { "x": "50%", "y": "90%", "text-anchor": "middle", "fill": "red", "font-size": 16, "pointer-events": "none" } ); createText( tit, "RapidSVG 1.0 (Demo/Unlicensed)"); } function GetCheckState( name) { var check = GetCheck( name); if(check) return check.state; else return -1; } function GetRadioState( name) { var radio = GetRadio( name); if(radio) return radio.state; else return -1; } function GetCheck( name) { var yDk483 = null; if( iBp777.length > 0) { for( var j=0; j<iBp777.length; j++) { if(iBp777[j].id == name) return iBp777[j]; } } if(tQw619.length > 0) { for( var i=0; i< tQw619.length; i++) { yDk483 = GetRecCheck(tQw619[i], name); if(yDk483) return yDk483; } } return yDk483; } function GetRecCheck( grp, name) { var yDk483 = null; if( grp.iBp777.length > 0) { for( var j=0; j<grp.iBp777.length; j++) { if(grp.iBp777[j].id == name) return grp.iBp777[j]; } } if(grp.tQw619.length > 0) { for( var i=0; i< grp.tQw619.length; i++) { yDk483 = GetRecCheck(grp.tQw619[i], name); if(yDk483) return yDk483; } } return yDk483; } function GetRadio( name) { var yDk483 = null; if( yDx133.length > 0) { for( var j=0; j<yDx133.length; j++) { if(yDx133[j].id == name) return yDx133[j]; } } if(tQw619.length > 0) { for( var i=0; i< tQw619.length; i++) { yDk483 = GetRecRadio(tQw619[i], name); if(yDk483) return yDk483; } } return yDk483; } function GetRecRadio( grp, name) { var yDk483 = null; if( grp.yDx133.length > 0) { for( var j=0; j<grp.yDx133.length; j++) { if(grp.yDx133[j].id == name) return grp.yDx133[j]; } } if(grp.tQw619.length > 0) { for( var i=0; i< grp.tQw619.length; i++) { yDk483 = GetRecRadio(grp.tQw619[i], name); if(yDk483) return yDk483; } } return yDk483; } function CheckHyperState( name, state) { var hyp = GetHyper( name); if(hyp) { var sts = state.split( ";"); for(var i=0; i<sts.length; i++) { var bState = false; switch( parseInt(sts[i]) ) { case 0: bState = true; break; case 1: if(hyp.tg == 0) bState = true; break; case 2: if(hyp.tg == 1) bState = true; break; case 3: case 4: case 5: case 6: if( hyp.bstate == parseInt(sts[i]) ) bState = true; break; } if( bState) return bState; } return false; } else return true; } function GetHyper( name) { var yDk483 = null; if( dTp307.length > 0) { for( var j=0; j<dTp307.length; j++) { if(dTp307[j].id == name) return dTp307[j]; } } if(tQw619.length > 0) { for( var i=0; i< tQw619.length; i++) { yDk483 = GetRecHyper(tQw619[i], name); if(yDk483) return yDk483; } } return yDk483; } function GetRecHyper( grp, name) { var yDk483 = null; if( grp.dTp307.length > 0) { for( var j=0; j<grp.dTp307.length; j++) { if(grp.dTp307[j].id == name) return grp.dTp307[j]; } } if(grp.tQw619.length > 0) { for( var i=0; i< grp.tQw619.length; i++) { yDk483 = GetRecHyper(grp.tQw619[i], name); if(yDk483) return yDk483; } } return yDk483; } function GetValFld( name) { var yDk483 = null; if( iNs824.length > 0) { for( var j=0; j<iNs824.length; j++) { if(iNs824[j].id == name) return iNs824[j]; } } if(tQw619.length > 0) { for( var i=0; i< tQw619.length; i++) { yDk483 = GetRecValFld(tQw619[i], name); if(yDk483) return yDk483; } } return yDk483; } function GetRecValFld( grp, name) { var yDk483 = null; if( grp.iNs824.length > 0) { for( var j=0; j<grp.iNs824.length; j++) { if(grp.iNs824[j].id == name) return grp.iNs824[j]; } } if(grp.tQw619.length > 0) { for( var i=0; i< grp.tQw619.length; i++) { yDk483 = GetRecValFld(grp.tQw619[i], name); if(yDk483) return yDk483; } } return yDk483; } function GetComboSelected( name) { var combo = GetCombo(name); if( combo) return combo.GetSelected(); else return ""; } function GetCombo( name) { var yDk483 = null; if( kYn978.length > 0) { for( var j=0; j<kYn978.length; j++) { if(kYn978[j].id == name) return kYn978[j]; } } if(tQw619.length > 0) { for( var i=0; i< tQw619.length; i++) { yDk483 = GetRecCombo(tQw619[i], name); if(yDk483) return yDk483; } } return yDk483; } function GetRecCombo( grp, name) { var yDk483 = null; if( grp.kYn978.length > 0) { for( var j=0; j<grp.iNs824.length; j++) { if(grp.kYn978[j].id == name) return grp.kYn978[j]; } } if(grp.tQw619.length > 0) { for( var i=0; i< grp.tQw619.length; i++) { yDk483 = GetRecCombo(grp.tQw619[i], name); if(yDk483) return yDk483; } } return yDk483; } function CheckRadioClear( radio) { var grp = null; for( var i=0; i< tQw619.length; i++) { if(tQw619[i]) grp = GetGroupByRadio( radio.id, tQw619[i] ); if(grp) i = tQw619.length; } if( grp ) { for( var j=0; j<grp.yDx133.length; j++) { if( grp.yDx133.length <= 1) return; if( grp.yDx133[j].state == 1 ) { grp.yDx133[j].check.setAttribute("display", "none"); grp.yDx133[j].state = 0; } } } } function GetGroupByRadio( name, grp) { var yDk483 = null; alert(grp.node.id ); if( grp.yDx133.length > 0) { for( var j=0; j<grp.yDx133.length; j++) { if(grp.yDx133[j].id == name) return grp; } }alert(grp.tQw619.length ); if(grp.tQw619.length > 0) { for( var i=0; i< grp.tQw619.length; i++) { yDk483 = GetGroupByRadio( name, grp.tQw619[i] ); if(yDk483) return yDk483; } } return yDk483; } function writeDefaultColors(nLx823) { aEm599 = nLx823.getAttribute("btn"); bCe765 = nLx823.getAttribute("actBar"); hNt852 = nLx823.getAttribute("InactBar"); dUr974 = nLx823.getAttribute("htxt"); } function keyPress(evt) { if( !xKw452.getElementById("valid_message") ) { if( rMs885 ) rMs885.KeyPress( evt ); } else if( evt.charCode == 32 ) { } } function keyDown( evt ) { if( !xKw452.getElementById("valid_message") ) { if( rMs885 ) rMs885.KeyDown(evt); } } function CheckFocus(t) { if(t) { if(rMs885) rMs885.removeFocus(); rMs885 = t; rMs885.setFocus(); } else rMs885 = null; } function createNode( type, parent, attrib ) { var svgdoc = parent.getOwnerDocument(); var node = svgdoc.createElement( type); for( var attrId in attrib) { switch(attrId) { default: node.setAttribute( attrId, attrib[attrId] ); break; case 'xlink:href': node.setAttributeNS( "http://www.w3.org/1999/xlink", attrId, attrib[attrId] ); break; case 'xml:space': node.setAttributeNS( "http://www.w3.org/XML/1998/namespace", attrId, attrib[attrId] ); break; } } parent.appendChild( node); return node; } function createOnly( type, parent, attrib ) { var svgdoc = parent.getOwnerDocument(); var node = svgdoc.createElement( type); for( var attrId in attrib) { switch(attrId) { default: node.setAttribute( attrId, attrib[attrId] ); break; case 'xlink:href': node.setAttributeNS( "http://www.w3.org/1999/xlink", attrId, attrib[attrId] ); break; case 'xml:space': node.setAttributeNS( "http://www.w3.org/XML/1998/namespace", attrId, attrib[attrId] ); break; } } return node; } function setFontStyle( node, nstyle) { switch( nstyle) { case 0: break; case 1: node.setAttribute( "font-style", "italic"); break; case 2: node.setAttribute( "font-weight", "bold"); break; case 3: node.setAttribute( "font-weight", "bold"); node.setAttribute( "font-style", "italic"); break; default: break; } } function createText( parent, ch) { var svgdoc = parent.getOwnerDocument(); var node = svgdoc.createTextNode(ch); parent.appendChild(node); return node; } function draw3DRect( parent, nx, ny, nwd, nht, szlight, szshad, szfc) { var nx1 = nx; var ny1 = ny; var nx2 = nx + nwd; var ny2 = ny + nht; gr = createNode( "g", parent, {"fill": szfc } ); var szdat = "M "+ nx1 + "," + ny2 + " L " + nx1 + "," + ny1 + " L " + nx2 + "," + ny1; createNode( "path", gr, {"d": szdat, "stroke": szlight, "fill": szfc } ); szdat = "M "+ nx1 + "," + ny2 + " L " + nx2 + "," + ny2 + " L " + nx2 + "," + ny1; createNode( "path", gr, {"d": szdat, "stroke": szshad, "fill": szfc } ); return gr; } function drawEllipse( parent, nx, ny, nwd, nht, fill, stroke) { var cnst = 0.2761423749154; var nofx = nwd * cnst; var nofy = nht * cnst; var ncx = nx + nwd/2; var ncy = ny + nht/2; var p0x,p1x,p2x,p3x,p4x,p5x,p6x,p7x,p8x,p9x,p10x,p11x,p12x; var p0y,p1y,p2y,p3y,p4y,p5y,p6y,p7y,p8y,p9y,p10y,p11y,p12y; p0x = nx; p1x = nx; p11x = nx; p12x = nx; p5x = nx + nwd; p6x = nx + nwd; p7x = nx + nwd; p2x = ncx - nofx; p10x = ncx - nofx; p4x = ncx + nofx; p8x = ncx + nofx; p3x = ncx; p9x = ncx; p2y = ny; p3y = ny; p4y = ny; p8y = ny+nht; p9y = ny+nht; p10y = ny+nht; p7y = ncy + nofy; p11y = ncy + nofy; p1y = ncy - nofy; p5y = ncy - nofy; p0y = ncy; p12y = ncy; p6y = ncy; var pth = "M "+p0x+","+p0y+" C "+p1x+","+p1y+" "+p2x+","+p2y+" "+p3x+","+p3y+" "; pth += " C "+p4x+","+p4y+" "+p5x+","+p5y+" "+p6x+","+p6y+" "; pth += " C "+p7x+","+p7y+" "+p8x+","+p8y+" "+p9x+","+p9y+" "; pth += " C "+p10x+","+p10y+" "+p11x+","+p11y+" "+p12x+","+p12y+" "; var ell = createNode( "path", parent, {"d": pth, "stroke": stroke, "fill": fill } ); return ell; } var oBf570; var uBi263, fJg827; var sWo323, wJh173; function showMsg( szicon, szcapz, szmsg, tgt, param) { var root = xKw452.rootElement; var szHlight = "RGB(250,250,250)"; var szHshad = "RGB(24,24,24)"; var szshad = "RGB(124,124,124)"; sWo323 = tgt; wJh173 = param; var rwd = parseFloat( root.getAttribute("width")); var rht = parseFloat( root.getAttribute("height")); var nx = 0; var ny = 0; var nwd = 300; var nht = 120; var nbar = 16; var nfz = 14; var ntstrt = 75; createNode( "rect", root, { "id": "valid_message_rect","width": "100%", "height": "100%", "fill-opacity": 0 }); var gr = createNode( "g" , root, { "id": "valid_message" }); var st = szmsg.split('\\n'); var ms = createOnly( "text", gr, { "x": ntstrt,"y": 35, "font-size": nfz, "pointer-events": "none", "xml:space": "preserve" }); for(var i=0; i< st.length; i++) { var ts = createNode( "tspan", ms, { "x": ntstrt, "dy": "1em" }); createText( ts, st[i]); if( ts.getComputedTextLength() > ( nwd - ntstrt ) ) nwd += ts.getComputedTextLength() + ntstrt - nwd + 10; } if((st.length * nfz + 85) > nht) nht = st.length * nfz + 85; nx = rwd/2 - nwd/2; ny = rht/2 - nht/2; var sztran = "translate( "+ nx +","+ ny +")"; gr.setAttribute( "transform", sztran); draw3DRect( gr, 0, 0, nwd, nht, aEm599, szHshad, aEm599); draw3DRect( gr, 1, 1, nwd - 2, nht - 2, szHlight, szshad, aEm599); createNode( "rect", gr, { "x": 4, "y": 4, "width": nwd - 8, "height": nbar, "fill": bCe765, "onmousedown": "startdrag(evt)", "onmouseup": "enddrag()"}); if( szcapz) { var s = createNode( "svg", gr, { "x": 4, "y": 4, "width": nwd - 18, "height": nbar, "pointer-events": "none"} ); var cap = createNode( "text", s, { "x": 4, "y": nbar - 4, "fill": dUr974, "pointer-events": "none", "onmousedown": "startdrag(evt)", "onmouseup": "enddrag()"}); createText( cap, szcapz); } if(szicon != "") createNode( "image", gr, { "x": 20, "y": nht / 2 - 25, "width": 50, "height": 50, "xlink:href": szicon }); gr.appendChild(ms); var nbtnht = 20; var nbtnwd = 50; var nbtnx = nwd/2 - nbtnwd/2; var nbtny = nht - nbtnht - 15; var ok = draw3DRect( gr, nbtnx, nbtny, nbtnwd, nbtnht, szHlight, szHshad, aEm599); ok.setAttribute( "onclick", "HideMsg()"); ok.setAttribute( "onmousedown", "ok()"); ok.setAttribute( "onmouseup", "up()"); ok.setAttribute( "onmouseout", "up()"); ok.setAttribute( "id", "validok" ); var oktxt = createNode( "text", ok, { "font-size": "13", "pointer-events": "none", "fill": "black" }); setCapzAlign( oktxt, 4, nbtnx, nbtny, nbtnwd, nbtnht); ss = createText( oktxt, "OK" ); var cls = draw3DRect( gr, nwd-18, 6, 12, 12, szHlight, szHshad, aEm599); createNode("line", cls, { "x1": (nwd-16), "y1": 8, "x2": (nwd-8), "y2": 16, "stroke": "RGB(0,0,0)" }); createNode("line", cls, { "x1": (nwd-8), "y1": 8, "x2": (nwd-16), "y2": 16, "stroke": "RGB(0,0,0)" }); cls.setAttribute( "onclick", "HideMsg()"); return gr; } function ok() { var szHlight = "RGB(250,250,250)"; var szshad = "RGB(124,124,124)"; var ms = xKw452.getElementById("validok"); if(ms.firstChild.getAttribute("stroke") == szHlight) ms.firstChild.setAttribute("stroke", szshad); } function up() { var szHlight = "RGB(250,250,250)"; var szshad = "RGB(124,124,124)"; var ms = xKw452.getElementById("validok"); if( ms.firstChild.getAttribute("stroke") == szshad) ms.firstChild.setAttribute("stroke", szHlight); } function HideMsg() { var ms = xKw452.getElementById("valid_message"); var rct = xKw452.getElementById("valid_message_rect"); xKw452.rootElement.removeChild(rct); xKw452.rootElement.removeChild(ms); if( sWo323 ) sWo323.OnValidation( wJh173 ); sWo323 = null; wJh173 = -1; } function startdrag(e) { var root = e.getTarget().ownerDocument.rootElement; var ctm = root.getCTM(); var prtm = e.getTarget().parentNode.getCTM(); var ex = (e.clientX - ctm.e)/root.currentScale; var ey = (e.clientY - ctm.f)/root.currentScale; oBf570 = 1; uBi263 = ex - prtm.e; fJg827 = ey - prtm.f; if(nOt565 == null) nOt565 = e.getTarget().parentNode; } function enddrag() { oBf570 = 0; nOt565 = null; } function drag( evt) { if( nOt565) { var doc = evt.getTarget().ownerDocument; var tgt = nOt565; var ctm = doc.rootElement.getCTM(); var root= doc.rootElement; if( oBf570 == 1) { var ex = (evt.clientX - ctm.e)/root.currentScale; var ey = (evt.clientY - ctm.f)/root.currentScale; var dx = ex - uBi263; var dy = ey - fJg827; var tran = "translate( "+dx+","+dy+")"; tgt.setAttribute("transform", tran) } } } function showImg( img, tgt, param) { var root = xKw452.rootElement; var szHlight = "RGB(250,250,250)"; var szHshad = "RGB(24,24,24)"; var szshad = "RGB(124,124,124)"; var rwd = parseFloat( root.getAttribute("width")); var rht = parseFloat( root.getAttribute("height")); var nx = 0; var ny = 0; var nwd = 300; var nht = 300; var nbar = 16; var fz = 14; nx = rwd/2 - nwd/2; ny = rht/2 - nht/2; sWo323 = tgt; wJh173 = param; createNode( "rect", root, { "id": "valid_message_rect","width": "100%", "height": "100%", "fill-opacity": 0 }); var tran = "translate( "+nx+","+ny+")"; var gr = createNode( "g" , root, { "id": "valid_message", "transform": tran }); draw3DRect( gr, 0, 0, nwd, nht, aEm599, szHshad, aEm599); draw3DRect( gr, 1, 1, nwd-2, nht-2, szHlight, szshad, aEm599); createNode( "rect", gr, { "x": 4, "y": 4, "width": nwd-8, "height": nbar, "fill": bCe765, "onmousedown": "startdrag(evt)", "onmouseup": "enddrag()"}); var cls = draw3DRect( gr, nwd-18, 6, 12, 12, szHlight, szHshad, aEm599); createNode("line", cls, { "x1": (nwd-16), "y1": 8, "x2": (nwd-8), "y2": 16, "stroke": "RGB(0,0,0)" }); createNode("line", cls, { "x1": (nwd-8), "y1": 8, "x2": (nwd-16), "y2": 16, "stroke": "RGB(0,0,0)" }); cls.setAttribute( "onclick", "HideMsg()"); createNode( "image", gr, { "x": 4, "y": 8+nbar, "width": nwd-8, "height": nht -12 -nbar, "image-rendering": "optimizeSpeed", "xlink:href": img}); } function draw3DCircle( parent, x, y, r, szlight, szshad, fill) { var qr = r/4; var hr = r/2; var ndx = 0; var ndy = 0; trans = "translate("+(x+hr)+","+(y+hr)+"),rotate(-45)"; var gr = createNode( "g", parent, { "transform": trans }); var pth = "M "+(-hr)+","+(ndy)+" C "+(-hr)+","+(-qr)+" "+(-qr)+","+(-hr)+" "+(ndx)+","+(-hr)+" C "+(qr)+","+(-hr)+" "; pth += (hr)+","+(-qr)+" "+(hr)+","+(ndy); createNode( "path", gr, { "d": pth, "stroke": szlight, "fill": fill }); pth = "M "+(hr)+","+(ndy)+" C "+(hr)+","+(qr)+" "+(qr)+","+(hr)+" "+(ndx)+","+(hr)+" C "; pth += (-qr)+","+(hr)+" "+(-hr)+","+(qr)+" "+(-hr)+","+(ndy); createNode( "path", gr, { "d": pth, "stroke": szshad, "fill": fill }); } function setCapzAlign( node, ntype, x, y, width, height) { nfz = parseInt(node.getAttribute("font-size")); switch( ntype ) { case 4: node.setAttribute( "x", x + width/2 ); node.setAttribute( "y", y + height/2 + nfz/4 ); node.setAttribute( "text-anchor", "middle" ); break; case 1: node.setAttribute( "x", x + 4 ); node.setAttribute( "y", y + height/2 + nfz/4 ); node.setAttribute( "text-anchor", "start" ); break; case 0: node.setAttribute( "x", x + width -2 ); node.setAttribute( "y", y + height/2 + nfz/4 ); node.setAttribute( "text-anchor", "end" ); break; case 2: node.setAttribute( "x", x + width/2 ); node.setAttribute( "y", y + nfz + 4 ); node.setAttribute( "text-anchor", "middle" ); break; case 3: node.setAttribute( "x", x + width/2 ); node.setAttribute( "y", y + height - 4 ); node.setAttribute( "text-anchor", "middle" ); break; default: node.setAttribute( "x", x + width/2 ); node.setAttribute( "y", y + height/2 ); node.setAttribute( "text-anchor", "middle" ); break; } } var wId994 = 0; var tSv20 = null; var qAv505 = null; var gAb20 = 250; function hyperlink() { var parent,nLx823; if ( arguments.length >= 2 ) { nLx823 = arguments[0]; parent = arguments[1]; this.id = nLx823.getAttribute( "id"); this.x = parseInt( nLx823.getAttribute( "x")); this.y = parseInt( nLx823.getAttribute( "y")); this.wd = parseInt( nLx823.getAttribute( "width")); this.ht = parseInt( nLx823.getAttribute( "height")); this.bs = 1; this.at = parseInt( nLx823.getAttribute( "attr")); this.cap = nLx823.getAttribute( "caption"); this.al = parseInt( nLx823.getAttribute( "align")); this.fn = nLx823.getAttribute( "font"); this.fs = parseInt( nLx823.getAttribute( "font-style")); this.fill = nLx823.getAttribute( "fill"); this.fop = nLx823.getAttribute( "fill-opacity"); this.fc = nLx823.getAttribute( "font-color"); this.fcop = nLx823.getAttribute( "font-opacity"); this.fz = parseFloat(nLx823.getAttribute( "font-size")); this.fs = nLx823.getAttribute( "font-style"); this.fw = nLx823.getAttribute( "font-weight"); this.trans = nLx823.getAttribute( "transform"); this.tt = nLx823.getAttribute( "tooltip"); this.inv = parseInt( nLx823.getAttribute( "invert")); this.tog = parseInt( nLx823.getAttribute( "toggle")); this.tmout = parseInt( nLx823.getAttribute( "timeout")); this.func = nLx823.tagName; this.tgt = parseInt( nLx823.getAttribute( "target")); } if(this.fill == "none") { this.fill = "white"; this.fop = 0; } var trans = "translate(" + this.x +"," + this.y +")"; if(this.trans) trans = this.trans + trans; this.node = createOnly( "g", parent, { "id": this.id, "transform": trans} ); parent.insertBefore( this.node, nLx823); this.state = 0; this.drawBorder(); this.capz = createNode( "text", this.node, { "font-family": this.fn, "font-size": this.fz, "fill": this.fc, "fill-opacity":this.fcop, "pointer-events": "none"}); setFontStyle( this.capz, this.fs); var nflt = 0; var ncx = 0; var ncw = 0; var ncy = 0; if( this.func == "sbl:radio") this.bs = 2; else if(this.func == "sbl:check") this.bs = 0; else this.bs = 1; var flat; if( this.at == 1) flat = 1; else flat = 0; switch( this.bs) { case 1: setCapzAlign( this.capz, this.al, 2, 2, this.wd - 4, this.ht - 4); this.check = null; break; case 0: ncw = 12; ncx = 12; ncy = this.ht/2 - ncw/2; if( this.wd > ( ncx+ ncw)) { this.check = this.drawCheck( ncx, ncy, ncw, flat); setCapzAlign( this.capz, this.al, ncx + ncw + 2, 2, this.wd - ( ncx + ncw + 2), this.ht - 4); } break; case 2: ncw = 12; ncx = 12; ncy = this.ht/2 - ncw/2; if( this.wd > ( ncx+ ncw)) { this.check = this.drawRadio( ncx, ncy, ncw, flat); setCapzAlign( this.capz, this.al, ncx + ncw + 2, 2, this.wd-( ncx + ncw + 2), this.ht - 4); } break; default: setCapzAlign( this.capz, this.al, 2, 2, this.wd - 4, this.ht - 4); this.check = null; } if(this.cap) { var tn = this.node.ownerDocument.createTextNode( this.cap); this.capz.appendChild(tn); if( this.capz.getComputedTextLength() > (this.wd - ncw - ncx) || this.fz > this.ht ) { var s = createNode( "svg", this.node, { "x": (ncx+ ncw), "width": (this.wd - ncw - ncx), "height": this.ht} ); this.node.removeChild(this.capz); s.appendChild(this.capz); } } this.dwn = 0; if(this.func == 'sbl:hyperlink') { this.tg = 0; this.bstate = -1; } if( this.inv == 1) this.toggle(); if( this.tt) this.tip = this.CreateToolTip( this.tt); if( nLx823.hasChildNodes && this.func == 'sbl:hyperlink') { this.parseValid( nLx823 ); this.key = -1; } else if( !nLx823.hasChildNodes && this.func == 'sbl:hyperlink') { this.valkey = null; this.mbv = null; } this.node.ownerDocument.rootElement.addEventListener('unload', this, false); this.node.addEventListener('click', this, false); this.node.addEventListener('mousedown', this, false); this.node.addEventListener('mouseup', this, false); this.node.addEventListener('mousemove', this, false); this.node.addEventListener('mouseover', this, false); this.node.addEventListener('mouseout', this, false); if(this.tmout && this.tmout > 0) HypTimeOut( this.tmout, this); }; hyperlink.prototype.parseValid = function(parent) { this.valkey = new Array(); var tf = parent.getElementsByTagNameNS( SBL.NAMESPACE, "*"); for( var t = tf.item(0); t; t = tf.item(0)) { tname = t.getTagName().replace(/^[^:]+:/, ""); if( tname == 'valKey') this.valkey[this.valkey.length] = new ValKey( t); if( tname == 'mbvElem' ) this.getMBV(t); parent.removeChild( t); } }; hyperlink.prototype.handleEvent = function(e) { var szlight = "RGB(250,250,250)"; var szshad = "RGB(24,24,24)"; switch (e.type) { case 'unload': this.node.removeEventListener('click', this, false); this.node.removeEventListener('mousedown', this, false); this.node.removeEventListener('mouseup', this, false); this.node.removeEventListener('mousemove', this, false); this.node.removeEventListener('mouseover', this, false); this.node.removeEventListener('mouseout', this, false); break; case 'mousedown': CheckFocus(this); if(this.tog != 1) { this.toggle(); this.dwn = 1; } break; case 'mouseup': if(this.tog != 1 && this.dwn == 1) this.toggle(); this.dwn = 0; break; case 'mouseover': if(this.at == 5) { if( this.rect.firstChild.getAttribute("fill") == this.fill ) { this.rect.firstChild.setAttribute("stroke", szlight); this.rect.lastChild.setAttribute("stroke", szshad); } else { this.rect.firstChild.setAttribute("stroke", szshad); this.rect.lastChild.setAttribute("stroke", szlight); } } if( this.tt && this.tip.getAttribute("display") == "none") this.ShowToolTip( e); this.disableContextMenu(); break; case 'mousemove': if( this.tt && this.tip.getAttribute("display") == "inline") { this.mcnt++; if( this.mcnt > 10) this.tip.setAttribute("display", "none"); } break; case 'mouseout': if(this.at == 5) { if( this.rect.firstChild.getAttribute("stroke") == szlight || this.rect.lastChild.getAttribute("stroke") == szlight) { this.rect.firstChild.setAttribute("stroke", "none"); this.rect.lastChild.setAttribute("stroke", "none"); } } if(this.tog != 1 && this.dwn == 1) { this.toggle(); this.dwn = 0; } if( this.tt && this.tip.getAttribute("display") == "inline") { this.tip.setAttribute("display", "none"); } this.enableContextMenu(); break; case 'click': if(this.func == 'sbl:radio') CheckRadioClear(this); this.state = (this.state==0)?1:0; if( this.check) { if(this.state == 1 ) this.check.setAttribute("display", "inline"); else this.check.setAttribute("display", "none"); } if(this.tog == 1) this.toggle(); if(this.func == 'sbl:hyperlink') { this.checkforVal( e); } break; default: break; } }; hyperlink.prototype.setFocus = function() { this.focus = true; }; hyperlink.prototype.removeFocus = function() { this.focus = false; }; hyperlink.prototype.KeyPress = function(evt) { }; hyperlink.prototype.KeyDown = function(evt) { }; function clearClick() { if(qAv505 != null && wId994 <=1 ) { if(tSv20 == 0) qAv505.OnLeftSingleClick(); else if( tSv20 == 2) qAv505.OnRightSingleClick(); } wId994 = 0; tSv20 = null; qAv505 = null; } hyperlink.prototype.checkforVal = function(e) { if( tSv20 == null) { wId994++; tSv20 = e.button; qAv505 = this; setTimeout("clearClick()", gAb20); } else { if( tSv20 == e.button) wId994++; } if( e.button == 0) { if(wId994 == 2) this.OnLeftDblClick(); } else if( e.button == 2) { if(wId994 == 2) this.OnRightDblClick(); } }; hyperlink.prototype.OnLeftSingleClick = function() { this.key = 0; this.bstate = 3; this.doValid(); }; hyperlink.prototype.OnLeftDblClick = function() { this.key = 1; this.bstate = 4; this.doValid(); }; hyperlink.prototype.OnRightSingleClick = function() { this.key = 2; this.bstate = 5; this.doValid(); }; hyperlink.prototype.OnRightDblClick = function() { this.key = 3; this.bstate = 6; this.doValid(); }; hyperlink.prototype.doValid = function() { var szclk; var vald = null; var nvtrgt = 0; switch(this.key) { case 0: szclk = "LeftSClick"; break; case 1: szclk = "LeftDblClick"; break; case 2: szclk = "RightSClick"; break; case 3: szclk = "RightDblClick"; break; case 4: szclk = "OnTimeOut"; break; default: break; } if(this.key>=0 && this.key<=4 && this.valkey != null ) { for(var i=0; i<this.valkey.length; i++) { if(this.valkey[i].key == szclk) vald = this.valkey[i]; } if( vald != null ) { if( this.mbv == null ) { this.CheckValidateTarget( vald ); } else { var bchk = true; for( var j = 0; j < this.mbv.length; j++) { bchk = this.CheckMultiBtnState( this.mbv[j] ); if(!bchk) j = this.mbv.length; } if( bchk ) this.CheckValidateTarget( vald ); else { if( vald.erMsg ) showMsg( vald.erIco, vald.erCap, vald.erMsg, this, 0); } } } else { var err; var erVal = null; switch(this.key) { case 0: err = "RightSClick"; break; case 1: err = "RightDblClick"; break; case 2: err = "LeftSClick"; break; case 3: err = "LeftDblClick"; break; default: break; } for(var i=0; i<this.valkey.length; i++) { if(this.valkey[i].key == err) erVal = this.valkey[i]; } if(erVal != null) { if( erVal.erMsg ) showMsg( erVal.erIco, erVal.erCap, erVal.erMsg, this, 0); } } } this.key = -1; }; hyperlink.prototype.CheckValidateTarget = function( vald ) { if(!vald.vTgt ) { this.doValidTarget(vald); } else { var val = GetValFld( vald.vTgt); if( val.OnValidationTarget() ) this.doValidTarget(vald); else if( vald.erMsg ) showMsg( vald.erIco, vald.erCap, vald.erMsg, this, 0); } }; hyperlink.prototype.doValidTarget = function( vald ) { this.vald = vald; if(vald.vMsg) { showMsg( vald.vIco, vald.vCap, vald.vMsg, this, 1); } else if(vald.vImg) { showImg(vald.vImg, this, 1); } else this.OnValidation(1); }; var qXq52; var yTc804; var tCf605; var iSv844 = 500; hyperlink.prototype.OnValidation = function( state) { var nTime = 0; if( state == 1 ) { if(this.vald.run) { var scr = "window.open( \"" + this.vald.run + "\")" ; browserEval( scr); nTime += iSv844; } if(this.vald.url) { var scr = "window.open( \"" + this.vald.url + "\")" ; qXq52 = scr; setTimeout( "ExecuteUrl()", nTime); nTime += iSv844; } if(this.vald.gt) { var scr = "window.location = \"" + this.vald.gt + "\""; if(this.tgt) scr = "window.open( \"" + this.vald.gt + "\")" ; tCf605 = scr; setTimeout( "ExecuteGt()", nTime); nTime += iSv844; } if(this.vald.play) { var scr = "window.location = \"" + this.vald.play + "\"" ; if(this.tgt) scr = "window.open( \"" + this.vald.play + "\")" ; yTc804 = scr; setTimeout( "ExecutePlay()", nTime); } } else { } }; hyperlink.prototype.GetState = function() { }; hyperlink.prototype.drawBorder = function() { var szlight = "RGB(250,250,250)"; var szshad = "RGB(24,24,24)"; var szstrk = "RGB(144,144,124)"; switch( this.at) { case 2: this.rect = createNode( "rect", this.node, { "width": this.wd, "height": this.ht, "stroke": this.fc,"fill": this.fill, "fill-opacity": this.fop} ); break; case 3: this.rect = createNode( "rect", this.node, { "width": this.wd, "height": this.ht, "stroke":this.fc,"fill": this.fill, "rx":12, "ry":12 , "fill-opacity": this.fop } ); break; case 0: this.rect = draw3DRect( this.node, 0, 0, this.wd, this.ht, szlight, szshad, this.fill); this.node.getLastChild().setAttribute("fill-opacity", this.fop ); break; case 4: var ndx = 0.1* this.wd; var ndx = 4; var ndy = 0.1* this.ht; var ndy = 4; createNode( "rect", this.node, { "x":ndx, "y":ndy, "width": this.wd, "height": this.ht, "fill": szshad, "fill-opacity": this.fop } ); this.rect = createNode( "rect", this.node, { "width": this.wd, "height": this.ht, "fill": this.fill, "fill-opacity": this.fop} ); break; case 1: this.rect = createNode( "rect", this.node, { "width": this.wd, "height": this.ht, "fill": this.fill, "fill-opacity": this.fop} ); break; case 5: this.rect = draw3DRect( this.node, 0, 0, this.wd, this.ht, "none", "none", this.fill); this.node.getLastChild().setAttribute("fill-opacity", this.fop ); break; default : this.rect = createNode( "rect", this.node, { "width": this.wd, "height": this.ht, "fill": this.fill, "fill-opacity": this.fop} ); break; } }; hyperlink.prototype.toggle = function() { var szlight = "RGB(250,250,250)"; var szshad = "RGB(24,24,24)"; var szfll = "RGB(184,184,204)"; switch( this.at) { case 2: if( this.rect.getAttribute("fill") == this.fill ) this.rect.setAttribute( "fill", szfll ); else this.rect.setAttribute( "fill", this.fill ); break; case 3: if( this.rect.getAttribute("fill") == this.fill ) this.rect.setAttribute( "fill", szfll ); else this.rect.setAttribute( "fill", this.fill ); break; case 0: if( this.rect.firstChild.getAttribute("stroke") == szlight && this.rect.lastChild.getAttribute("stroke") == szshad) { this.rect.firstChild.setAttribute("stroke", szshad); this.rect.lastChild.setAttribute("stroke", szlight); } else if( this.rect.firstChild.getAttribute("stroke") == szshad && this.rect.lastChild.getAttribute("stroke") == szlight) { this.rect.firstChild.setAttribute("stroke", szlight); this.rect.lastChild.setAttribute("stroke", szshad); } break; case 4: if( this.func == 'sbl:hyperlink') { var ndx = 0.1* this.wd; var ndx = 4; var ndy = 0.1* this.ht; var ndy = 4; if(this.rect.getAttribute("x") == ndx) { this.rect.setAttribute("x", 0); this.rect.setAttribute("y", 0); } else { this.rect.setAttribute("x", ndx); this.rect.setAttribute("y", ndy); } } else { if( this.rect.getAttribute("fill") == this.fill ) this.rect.setAttribute( "fill", szfll ); else this.rect.setAttribute( "fill", this.fill ); } break; case 1: if( this.rect.getAttribute("fill") == this.fill ) this.rect.setAttribute( "fill", szfll ); else this.rect.setAttribute( "fill", this.fill ); break; case 5: if( this.rect.firstChild.getAttribute("stroke") == szlight && this.rect.lastChild.getAttribute("stroke") == szshad) { this.rect.firstChild.setAttribute("stroke", szshad); this.rect.lastChild.setAttribute("stroke", szlight); } else if( this.rect.firstChild.getAttribute("stroke") == szshad && this.rect.lastChild.getAttribute("stroke") == szlight) { this.rect.firstChild.setAttribute("stroke", szlight); this.rect.lastChild.setAttribute("stroke", szshad); } if( this.rect.firstChild.getAttribute("fill") == this.fill) { this.rect.firstChild.setAttribute("fill", szfll); this.rect.lastChild.setAttribute("fill", szfll); } else { this.rect.firstChild.setAttribute("fill", this.fill); this.rect.lastChild.setAttribute("fill", this.fill); } break; default: break; } mat = this.capz.getCTM(); if( this.func == 'sbl:hyperlink') { if( mat.e == 0 && mat.f == 0) this.capz.setAttribute("transform", "translate( 2, 2)"); else this.capz.setAttribute("transform", "translate( 0, 0)"); this.tg = (this.tg == 0)?1:0; } }; hyperlink.prototype.drawCheck = function( x, y, width, nflat) { var szHlight = "RGB(250,250,250)"; var szHshad = "RGB(24,24,24)"; var szlight = "RGB(230,200,230)"; var szshad = "RGB(124,124,124)"; var chk; if( nflat != 1) { draw3DRect( this.node, x, y, width, width, szshad, szHlight, "none"); draw3DRect( this.node, x+1, y+1, width-2, width-2, szHshad, aEm599, szHlight); pt1x = x+3; pt1y = y+width/2; pt2x = x+width/2-1; pt2y = y+width-3; pt3x = x+width-3; pt3y = y+3; pth = "M "+pt1x+","+pt1y+" L "+pt2x+","+pt2y+" L "+pt3x+","+pt3y; chk = createNode( "path", this.node, { "d": pth, "display":"none", "stroke": "black", "fill": "none", "stroke-width": 1.5 }); } else { createNode( "rect", this.node, {"x":x, "y":y, "width": width, "height": width, "fill": szHlight, "stroke": szHshad, "stroke-width": 1.5 } ); pth = "M "+x+","+y+" L "+(x+width)+","+(y+width)+" M "+(x+width)+","+y+" L "+x+","+(y+width) ; chk = createNode( "path", this.node, { "d": pth, "display":"none", "stroke": "black", "fill": "none", "stroke-width": 1.5 }); } return chk; }; hyperlink.prototype.drawRadio = function( x, y, width, nflat) { var szHlight = "RGB(250,250,250)"; var szHshad = "RGB(24,24,24)"; var szlight = "RGB(230,200,230)"; var szshad = "RGB(124,124,124)"; var chk; if( nflat != 1) { draw3DCircle( this.node, x, y, width, szshad, szHlight, "none"); draw3DCircle( this.node, x+1, y+1, width-2, szHshad, aEm599, szHlight); } else { createNode( "circle", this.node, {"cx":x+width/2, "cy": y+width/2, "r": width/2, "fill": szHlight, "stroke": szHshad, "stroke-width": 1.5 } ); } chk = createNode( "circle", this.node, { "cx":x+width/2, "cy": y+width/2, "r": width/2-3, "display":"none" }); return chk; }; hyperlink.prototype.CreateToolTip = function(ch) { var nht = 12; var gr = createNode( "g", this.node, { "display": "none"} ); var t = createOnly( "text", this.node, { "pointer-events": "none", "xml:space": "preserve"}); var tn = createText( t, ch ); var nlen = t.getComputedTextLength() + 8; createNode( "rect", gr, { "width": nlen, "height": nht, "stroke": "RGB(0,0,0)", "fill": "RGB(250,245,150)" }); t.setAttribute( "x", 2); t.setAttribute( "y", 10); gr.appendChild(t); return gr; }; hyperlink.prototype.ShowToolTip = function(e) { var nex = e.clientX; var ney = e.clientY; var rt = xKw452.rootElement; var rctm = rt.getCTM(); var nctm = this.node.getCTM(); var tctm = this.tip.getCTM(); var ntx = (nex - rctm.e )/rt.currentScale; var nty = (ney - rctm.f )/rt.currentScale; var ndtx = (this.x - rt.getCTM().e )/rt.currentScale; var ndty = (this.y - rt.getCTM().f )/rt.currentScale; this.mcnt = 0; var ndx = ntx - ndtx; var ndy = nty - ndty; if(ndx > this.wd ) ndx = this.wd; else if(ndx < 0 ) ndx = 0; if(ndy > this.ht) ndy = this.ht; else if( ndy < 0) ndy = 0; ndy += 10; this.tip.setAttribute( "transform", "translate( " + ndx + "," + ndy + " )" ); this.tip.setAttribute( "display", "inline"); }; hyperlink.prototype.createContextMenu = function() { this.menu = xKw452.getElementById("hyp_cmenu"); if( !this.menu ) { var df = createNode("menu", xKw452.rootElement, {} ); this.menu = createNode("menu", df, {"id": "hyp_cmenu"}); } }; hyperlink.prototype.disableContextMenu = function() { contextMenu.firstChild.setAttribute("display", "none"); }; hyperlink.prototype.enableContextMenu = function() { contextMenu.firstChild.setAttribute("display", "inline"); }; hyperlink.prototype.getMBV = function( nLx823 ) { if(!this.mbv) this.mbv = new Array(); this.mbv[this.mbv.length] = new MbvElem( nLx823 ); }; hyperlink.prototype.CheckMultiBtnState = function( mbv) { var bState = false; var sel, arSel; switch( mbv.btnType ) { case 0: bState = CheckHyperState(mbv.btnID, mbv.btnst); break; case 1: if( parseInt(mbv.btnst) == GetCheckState( mbv.btnID ) ) bState = true; break; case 2: if( parseInt(mbv.btnst) == GetRadioState( mbv.btnID ) ) bState = true; break; case 3: sel = GetComboSelected( mbv.btnID ); arSel = mbv.btnst.split(";"); for( var i=0; i<arSel.length; i++) { if( arSel[i] == sel ) { bState = true; i = arSel.length; } } break; } return bState; }; function ValKey(nLx823) { this.key = nLx823.getAttribute( "key"); this.run = nLx823.getAttribute( "run"); this.url = nLx823.getAttribute( "url"); this.vImg = nLx823.getAttribute( "valImg"); this.gt = nLx823.getAttribute( "goto"); this.play = nLx823.getAttribute( "play"); this.vTgt = nLx823.getAttribute( "valTarget"); this.vMsg = null; this.vIco = null; this.vCap = null; this.erMsg = null; this.erIco = null; this.erCap = null; if( nLx823.hasChildNodes()) this.parseMsg( nLx823); return this; }; ValKey.prototype.parseMsg = function (nLx823) { var tf = nLx823.getElementsByTagNameNS( SBL.NAMESPACE, "*"); for( var t = tf.item(0); t; t = tf.item(0)) { tname = t.getTagName().replace(/^[^:]+:/, ""); if( tname == 'valMsg') this.getMsg(t); nLx823.removeChild( t); } }; ValKey.prototype.getMsg = function(nLx823) { var er = parseInt( nLx823.getAttribute("err")); if( er == 0) { this.vMsg = nLx823.getAttribute("txt"); this.vIco = nLx823.getAttribute("ico"); this.vCap = nLx823.getAttribute("cap"); } else if( er == 1) { this.erMsg = nLx823.getAttribute("txt"); this.erIco = nLx823.getAttribute("ico"); this.erCap = nLx823.getAttribute("cap"); } }; function MbvElem( nLx823 ) { this.btnID = nLx823.getAttribute("id"); this.btnType = parseInt( nLx823.getAttribute("type") ); this.btnst = nLx823.getAttribute("status"); }; var qAv505timeout = null; function HypTimeOut( ntime, hyp) { var nLen; if(qAv505timeout == null) qAv505timeout = new Array(); nLen = qAv505timeout.length; qAv505timeout[nLen] = hyp; setTimeout( "OnTimeOut("+nLen+")", ntime*1000); } function OnTimeOut( n) { if(n<qAv505timeout.length) { qAv505timeout[n].key = 4; qAv505timeout[n].doValid(); } } function ExecuteGt() { browserEval(tCf605); tCf605 = ""; clearTimeout("ExecuteGt()"); } function ExecuteUrl() { browserEval(qXq52); qXq52 = ""; clearTimeout("ExecuteUrl()"); } function ExecutePlay() { browserEval(yTc804); yTc804 = ""; clearTimeout("ExecutePlay()"); } function combobox() { var nLx823, parent; if ( arguments.length == 2 ) { nLx823 = arguments[0]; parent = arguments[1]; this.id = nLx823.getAttribute( "id"); this.x = parseInt( nLx823.getAttribute( "x")); this.y = parseInt( nLx823.getAttribute( "y")); this.wd = parseInt( nLx823.getAttribute( "width")); this.ht = parseInt( nLx823.getAttribute( "height")); this.fill = nLx823.getAttribute( "fill"); this.fc = nLx823.getAttribute( "font-color"); this.fcop = nLx823.getAttribute( "font-opacity"); this.sty = parseInt( nLx823.getAttribute( "sty")); this.fn = nLx823.getAttribute( "font"); this.fz = parseFloat( nLx823.getAttribute( "font-size") ); this.fs = nLx823.getAttribute( "font-style"); this.fw = nLx823.getAttribute( "font-weight"); this.sel = nLx823.getAttribute( "sel"); this.trans = nLx823.getAttribute( "transform"); this.tgt = parseInt( nLx823.getAttribute( "target")); } if(this.fill == "none") { this.fill = "white"; this.fop = 0; } if( !this.sel ) this.sel = ""; trans = "translate(" + this.x +"," + this.y +")"; if(this.trans) trans = this.trans+trans; this.node = createOnly( "g", parent, { "id": this.id, "transform": trans} ); parent.insertBefore( this.node, nLx823); this.draw(); this.getItems(nLx823); this.dd = this.dropDown(); this.sl = -1; this.over = -1; this.fcs = null; this.node.ownerDocument.rootElement.addEventListener( 'unload', this, false); this.node.addEventListener( 'mousedown', this, false); this.node.addEventListener( 'mousemove', this, false); this.node.addEventListener( 'click', this, false); }; combobox.prototype.getItems = function(parent) { this.str = new Array(); var tf = parent.getElementsByTagNameNS( SBL.NAMESPACE, "*"); for( var t = tf.item(0); t; t = tf.item(0)) { tname = t.getTagName().replace(/^[^:]+:/, ""); if( tname == 'cmbStr') this.str[this.str.length] = new CmbStr( t); parent.removeChild( t); } }; combobox.prototype.handleEvent = function(e) { switch( e.type) { case 'mousedown': CheckFocus(this); if( e.getTarget() != this.fcs ) { if( e.getTarget() == this.btn && e.button == 0) { if( this.dd.getAttribute("display") == "none") this.dd.setAttribute("display","inline"); else { if(this.over != -1 ) { var pre = xKw452.getElementById(this.id+"_item"+this.over); pre.firstChild.setAttribute("fill", this.fill); pre.lastChild.setAttribute("fill", this.fc); } this.over = -1; this.dd.setAttribute("display","none"); } } else if( e.button == 0) { var tgt = e.getTarget(); var id = tgt.parentNode.id; var g = id.split( "item"); var mov = parseInt(g[g.length-1] ); if( mov >= 0 && mov < this.str.length ) { this.sl = mov; var txt = xKw452.createTextNode(this.str[this.sl].txt); if( this.ctxt.firstChild) this.ctxt.replaceChild( txt, this.ctxt.firstChild); else this.ctxt.appendChild(txt); this.doValid(); if(this.over != -1 ) { var pre = xKw452.getElementById(this.id+"_item"+this.over); pre.firstChild.setAttribute("fill", this.fill); pre.lastChild.setAttribute("fill", this.fc); } this.over = -1; this.dd.setAttribute("display","none"); } if( tgt == this.dd.firstChild && tgt.tagName == "rect") { if( this.over != -1 ) { this.sl = this.over; var pre = xKw452.getElementById(this.id+"_item"+this.sl); var txt = xKw452.createTextNode(this.str[this.sl].txt); if( this.ctxt.firstChild) this.ctxt.replaceChild( txt, this.ctxt.firstChild); else this.ctxt.appendChild(txt); this.doValid(); pre.firstChild.setAttribute("fill", this.fill); pre.lastChild.setAttribute("fill", this.fc); } this.over = -1; this.dd.setAttribute("display","none"); } } } break; case 'mousemove': if( e.getTarget() != this.fcs && e.getTarget() != this.btn ) { var tgt = e.getTarget(); var id = tgt.parentNode.id; var g = id.split( "item"); var mov = parseInt(g[g.length-1]); if( mov >= 0 && mov < this.str.length && this.over != mov) { if(this.over != -1 ) { var pre = xKw452.getElementById(this.id+"_item"+this.over); pre.firstChild.setAttribute("fill", this.fill); pre.lastChild.setAttribute("fill", this.fc); } this.over = mov; tgt.parentNode.firstChild.setAttribute("fill", bCe765); tgt.parentNode.lastChild.setAttribute("fill", dUr974); } } break; case 'click': break; case 'unload': this.node.removeEventListener( 'mousedown', this, false); this.node.removeEventListener( 'mousemove', this, false); this.node.removeEventListener( 'click', this, false); break; } }; combobox.prototype.GetSelected = function() { if(this.sl >= 0) return this.str[this.sl].txt; else return ""; }; combobox.prototype.setFocus = function() { var nsz = 4; var nbsz = 28; var nbw = nbsz - 8; var nbh = nbsz - 4; nbsz = this.ht; this.focus = true; this.fcs = createNode( "rect", this.node, { "x": nsz, "y": nsz, "width": this.wd - nbw - 2 * nsz, "height": nbsz - 2 * nsz, "fill": "none", "stroke": "grey", "stroke-dasharray": "4,4", "pointer-events": "none"} ); }; combobox.prototype.removeFocus = function() { this.focus = false; this.node.removeChild(this.fcs); if( this.dd.getAttribute("display") == "inline") this.dd.setAttribute("display","none"); this.fcs = null; }; combobox.prototype.KeyPress = function(evt) { }; combobox.prototype.KeyDown = function(evt) { if(this.str.length <= 0) return; var key = evt.keyCode; switch(key) { case 13: if( this.dd.getAttribute("display") == "none") this.dd.setAttribute("display","inline"); else { if( this.over != -1 ) { this.sl = this.over; var pre = xKw452.getElementById(this.id+"_item"+this.sl); var txt = xKw452.createTextNode(this.str[this.sl].txt); if( this.ctxt.firstChild) this.ctxt.replaceChild( txt, this.ctxt.firstChild); else this.ctxt.appendChild(txt); this.doValid(); pre.firstChild.setAttribute("fill", this.fill); pre.lastChild.setAttribute("fill", this.fc); } this.over = -1; this.dd.setAttribute("display","none"); } break; case 38: if( this.dd.getAttribute("display") == "inline") { if(this.over > -1 ) { var pre = xKw452.getElementById(this.id+"_item"+this.over); pre.firstChild.setAttribute("fill", this.fill); pre.lastChild.setAttribute("fill", this.fc); } if(this.over > 0 && this.over < this.str.length ) this.over --; var tgt = xKw452.getElementById(this.id+"_item"+this.over); tgt.firstChild.setAttribute("fill", bCe765); tgt.lastChild.setAttribute("fill", dUr974); } break; case 40: if( this.dd.getAttribute("display") == "inline") { if(this.over > -1 ) { var pre = xKw452.getElementById(this.id+"_item"+this.over); pre.firstChild.setAttribute("fill", this.fill); pre.lastChild.setAttribute("fill", this.fc); } if(this.over == -1 || this.over < (this.str.length - 1) ) this.over ++; var tgt = xKw452.getElementById(this.id+"_item"+this.over); tgt.firstChild.setAttribute("fill", bCe765); tgt.lastChild.setAttribute("fill", dUr974); } break; default: break; } }; combobox.prototype.draw = function() { var szHlight = "RGB(250,250,250)"; var szHshad = "RGB(24,24,24)"; var szshad = "RGB(124,124,124)"; var nsz = 28, btnwd, btnht, btnx, btny, bz; btnwd = nsz - 8; btnht = this.ht - 4; btnx = this.wd - btnwd - 2; btny = 2; if( btnwd > this.wd ) { btnwd = this.wd; btnx = 0; } draw3DRect( this.node, 0, 0, this.wd, this.ht, szshad, szHlight, "none"); draw3DRect( this.node, 1, 1, this.wd-2, this.ht-2, szHshad, aEm599, this.fill ); bcx = btnx + btnwd/2; bcy = btny + btnht/2; bz = nsz*0.2; if( (bz+4) > this.ht ) bz = this.ht/4; btn = draw3DRect( this.node, btnx, btny, btnwd, btnht, szHlight, szshad, aEm599); createNode( "polygon" , this.node, { "points": (bcx-bz)+","+(bcy-bz/2)+" "+(bcx+bz)+","+(bcy-bz/2)+" "+bcx+","+(bcy+bz/2)+" " }); this.btn = createNode( "rect", this.node, { "x": this.wd-btnwd-2, "y": 2, "width": btnwd, "height": btnht, "opacity": 0}); this.svg = createNode( "svg", this.node, { "x": 2, "y": 2, "width": this.wd - nsz, "height": btnht-4 }); this.ctxt = createNode( "text", this.svg, { "x": 4,"y": this.fz , "font-family": this.fn, "font-size": this.fz, "fill": this.fc, "font-style": this.fs, "font-weight": this.fw }); if( this.sel ) { slt = xKw452.createTextNode(this.sel); this.ctxt.appendChild(slt); } }; combobox.prototype.dropDown = function() { var nsz = 24; if( nsz < this.fz ) nsz = this.fz + 8; var sep = this.fz + this.fz*0.3; var nlen = this.str.length * sep; this.dht = nlen; if( this.dht <= 0) this.dht = nsz; var gr = createNode( "g", this.node, { "display": "none"}); createNode( "rect", gr, {"x": 0, "y": this.ht+1, "width": this.wd, "height": this.dht , "stroke": "black", "fill": this.fill}); var dropsvg = createNode( "svg", gr, {"x": 1, "y": this.ht+2, "width": this.wd-2, "height": this.dht-2 }); for( var i=0; i<this.str.length; i++) { var gn = createNode( "g", dropsvg, { "id": this.id+"_item"+i }); createNode( "rect", gn, { "x": 0, "y": sep*i, "width": this.wd-2, "height": sep, "fill": this.fill }); var ts = createNode( "text", gn, { "x": 4, "y": sep*(i+1)-(this.fz*0.2), "font-family": this.fn, "font-size": this.fz, "fill": this.fc, "pointer-events": "none", "font-style": this.fs, "font-weight": this.fw }); var tn = xKw452.createTextNode(this.str[i].txt); ts.appendChild( tn ); } return gr; }; combobox.prototype.doValid = function() { var nTime = 0; if(this.str[this.sl].run) { var scr = "window.open( \"" + this.str[this.sl].run + "\")" ; browserEval( scr); nTime += iSv844; } if(this.str[this.sl].url) { var scr = "window.open( \"" + this.str[this.sl].url + "\")" ; qXq52 = scr; setTimeout( "ExecuteUrl()", nTime); nTime += iSv844; } if(this.str[this.sl].gt) { var scr = "window.location = \"" + this.str[this.sl].gt + "\""; if(this.tgt) scr = "window.open( \"" + this.str[this.sl].gt + "\")" ; tCf605 = scr; setTimeout( "ExecuteGt()", nTime); nTime += iSv844; } if(this.str[this.sl].play) { var scr = "window.location = \"" + this.str[this.sl].play + "\"" ; if(this.tgt) scr = "window.open( \"" + this.str[this.sl].play + "\")" ; yTc804 = scr; setTimeout( "ExecutePlay()", nTime); } }; function CmbStr(nLx823) { this.txt = nLx823.getAttribute("str"); this.run = nLx823.getAttribute("run"); this.url = nLx823.getAttribute("url"); this.play = nLx823.getAttribute("play"); this.gt = nLx823.getAttribute("goto"); }; SBL= { NAMESPACE: "http://www.xstreamsoftware.com/sbl" }; function InstructionBox() { var nLx823, parent, vAu443, aNd118, uXp846, oTe818; if ( arguments.length == 2 ) { nLx823 = arguments[0]; parent = arguments[1]; this.id = nLx823.getAttribute( "id"); this.fc = nLx823.getAttribute( "font-color"); this.fill = nLx823.getAttribute( "fill"); this.fop = nLx823.getAttribute( "fill-opacity"); this.cap = nLx823.getAttribute( "caption"); this.x = parseInt( nLx823.getAttribute( "x")); this.y = parseInt( nLx823.getAttribute( "y")); this.wd = parseInt( nLx823.getAttribute( "width")); this.ht = parseInt( nLx823.getAttribute( "height")); this.fz = parseInt( nLx823.getAttribute( "font-size")); this.fs = nLx823.getAttribute( "font-style"); this.fw = nLx823.getAttribute( "font-weight"); this.font = nLx823.getAttribute( "font"); this.fcop = nLx823.getAttribute( "font-opacity"); this.ls = parseInt( nLx823.getAttribute( "ls")); this.trans = nLx823.getAttribute( "transform"); this.align = "left"; this.parent = parent; vAu443 = parseInt( nLx823.getAttribute( "ml")); aNd118 = parseInt( nLx823.getAttribute( "mt")); uXp846 = parseInt( nLx823.getAttribute( "mr")); oTe818 = parseInt( nLx823.getAttribute( "mb")); } if(this.fill == "none") { this.fill = "white"; this.fop = 0; } trans = "translate(" + this.x +"," + this.y +")"; if(this.trans) trans = this.trans+trans; this.node = createOnly( "g", this.parent, { "id": this.id, "transform": trans} ); this.parent.insertBefore( this.node, nLx823); this.other = createOnly( "g", this.parent, { "id": this.id, "transform": trans} ); switch( this.ls) { case 0: this.ls = "1em"; this.sep = 1; break; case 1: this.ls = "1.5em"; this.sep = 1.5; break; case 2: this.ls = "2em"; this.sep = 2; break; default: this.ls = "1em"; this.sep = 1; break; } this.calcTxtArea( vAu443, aNd118, uXp846, oTe818); this.draw(); this.drawMin(); this.max = false; this.AddText(nLx823); if( this.cy > this.ty+this.th && this.tw > 3*18 ) this.drawScrollBtn( true); else this.drawScrollBtn( false); this.node.addEventListener( "mousedown", this, false); this.node.addEventListener( "click", this, false); mBt375.addEventListener( "unload", this, false); }; InstructionBox.prototype.handleEvent = function(e) { switch(e.type) { case 'unload': if(this.other.parentNode) { var parent = this.other.parentNode; parent.replaceChild( this.node, this.other); this.node.setAttribute("transform", this.other.getAttribute("transform")); this.node.addEventListener( "click", this, false); this.other.removeEventListener( "click", this, false); this.max = false; } this.node.removeEventListener( "mousedown", this, false); this.node.removeEventListener( "click", this, false); break; case 'mousedown': this.BringTop(); nOt565 = this.node; CheckFocus(this); break; case 'click': CheckFocus(this); if(e.getTarget() == this.btnMax) { var parent = this.node.parentNode; parent.replaceChild( this.other, this.node); this.other.setAttribute("transform", this.node.getAttribute("transform")); this.other.addEventListener( "click", this, false); this.node.removeEventListener( "click", this, false); this.max = true; } if(e.getTarget() == this.othMax) { var parent = this.other.parentNode; parent.replaceChild( this.node, this.other); this.node.setAttribute("transform", this.other.getAttribute("transform")); this.node.addEventListener( "click", this, false); this.other.removeEventListener( "click", this, false); this.max = false; } if(e.getTarget() == this.btnUp) this.scrollUp(); if(e.getTarget() == this.btnDwn) this.scrollDown(); break; default: break; } }; InstructionBox.prototype.BringTop = function() { if(this.node.parentNode) { this.node.parentNode.removeChild( this.node); mBt375.appendChild( this.node); } else if(this.other.parentNode) { this.other.parentNode.removeChild( this.node); mBt375.appendChild( this.other); } }; InstructionBox.prototype.setFocus = function() { this.focus = true; if( !this.fcs ) this.fcs = createNode( "rect", this.node, { "x": this.tx, "y": this.ty + 2, "width": this.tw, "height": this.th - 4, "fill": "none", "stroke": "grey", "stroke-dasharray": "4,4", "pointer-events": "none"} ); else this.node.appendChild(this.fcs); this.bar.setAttribute( "fill", bCe765); this.othbar.setAttribute( "fill", bCe765); }; InstructionBox.prototype.removeFocus = function() { this.focus = false; if(this.fcs) this.node.removeChild(this.fcs); this.bar.setAttribute( "fill", hNt852); this.othbar.setAttribute( "fill", hNt852); }; InstructionBox.prototype.KeyPress = function(evt) { }; InstructionBox.prototype.KeyDown = function(evt) { var key = evt.keyCode; switch(key) { case 38: this.scrollDown(); break; case 40: this.scrollUp(); break; default: break; } }; InstructionBox.prototype.draw = function() { var szHlight = "RGB(250,250,250)"; var szHshad = "RGB(24,24,24)"; var szshad = "RGB(124,124,124)"; var nbar = 18; draw3DRect( this.node, 0, 0, this.wd, this.ht, aEm599, szHshad, "none"); draw3DRect( this.node, 1, 1, this.wd-2, this.ht-2, szHlight, szshad, "none"); createNode( "rect", this.node, { "x": 2.5, "y": 2.5, "width": this.wd-5, "height": this.ht-5, "fill": "none", "stroke": aEm599, "stroke-width": 2.5 } ); createNode( "rect", this.node, { "x": 5, "y": 5, "width": this.wd-10, "height": nbar+1, "fill": "none", "stroke": aEm599, "stroke-width": 4 } ); this.bar = createNode( "rect", this.node, { "x": 4, "y": 4, "width": this.wd-8, "height": nbar, "fill": hNt852, "onmousedown": "startdrag(evt)", "onmouseup": "enddrag()" }); if( this.cap) { var cap = createNode( "text", this.node, { "x": nbar+6, "y": nbar, "fill": dUr974, "pointer-events": "none", "onmousedown": "startdrag(evt)", "onmouseup": "enddrag()"}); createText( cap, this.cap); if(cap.getComputedTextLength() > (this.wd-nbar-14) ) { var clip = createNode( "svg", this.node, {"x": nbar+6, "y": 4,"width": this.wd-nbar-14, "height": nbar }); this.node.removeChild( cap); cap.setAttribute( "x", 0); cap.setAttribute( "y", nbar - 4); clip.appendChild( cap); } } var btnScrl = nbar - 6; var nsepx = 4; var nsepy = 3; var nx = this.wd - 4 - nsepx - btnScrl; var ny = 4 + nsepy; draw3DRect( this.node, 7 , 7, btnScrl, btnScrl, szHlight, szHshad, aEm599 ); createNode( "rect", this.node, { "x": 9, "y": nbar-3, "width": nbar-10, "height": 1, "straoke": szHshad }); this.btnMax = createNode( "rect", this.node, { "x": 7, "y": 7, "width": nbar-6, "height": nbar-6, "fill": bCe765, "fill-opacity": 0 }); draw3DRect( this.node, 4, nbar+8, this.wd-8, this.ht-nbar-12, szshad, szHlight, "none"); draw3DRect( this.node, 5, nbar+9, this.wd-10, this.ht-nbar-14, szHshad, aEm599, this.fill); this.node.getLastChild().setAttribute("fill-opacity", this.fop ); this.svg = createNode( "svg", this.node, { "x": this.tx, "y": this.ty, "width": this.tw, "height": this.th }); this.tnode = createNode( "text", this.svg, {"y":0,"font-size": this.fz, "fill": this.fc, "font-family":this.font, "fill-opacity":this.fcop, "font-style":this.fs, "font-weight":this.fw, "xml:space": "preserve"} ); this.test = createNode( "text", this.svg, {"y":0,"font-size": this.fz, "fill": this.fc, "font-family":this.font, "fill-opacity":this.fcop, "font-style":this.fs, "font-weight":this.fw, "xml:space": "preserve"} ); createText( this.test, '' ); }; InstructionBox.prototype.drawMin = function() { var szHlight = "RGB(250,250,250)"; var szHshad = "RGB(24,24,24)"; var szshad = "RGB(124,124,124)"; var nbar = 18; draw3DRect( this.other, 0, 0, this.wd, nbar + 6, aEm599, szHshad, aEm599); draw3DRect( this.other, 1, 1, this.wd-2, nbar + 4, szHlight, szshad, aEm599); this.othbar = createNode( "rect", this.other, { "x": 4, "y": 4, "width": this.wd-8, "height": nbar, "fill": hNt852, "onmousedown": "startdrag(evt)", "onmouseup": "enddrag()" }); if( this.cap) { var cap = createNode( "text", this.other, { "x": nbar+6, "y": nbar, "fill": dUr974, "pointer-events": "none", "onmousedown": "startdrag(evt)", "onmouseup": "enddrag()"}); createText( cap, this.cap); if(cap.getComputedTextLength() > (this.wd-nbar-14) ) { var clip = createNode( "svg", this.other, {"x": nbar+6, "y": 4,"width": this.wd-nbar-14, "height": nbar }); this.other.removeChild( cap); cap.setAttribute( "x", 0); cap.setAttribute( "y", nbar - 4); clip.appendChild( cap); } } draw3DRect( this.other, 7 , 7, nbar-6, nbar-6, szHlight, szHshad, aEm599 ); createNode( "rect", this.other, { "x": 9, "y": 9, "width": nbar-10, "height": nbar-10, "stroke": szHshad, "fill": "none" }); this.othMax = createNode( "rect", this.other, { "x": 7, "y": 7, "width": nbar-6, "height": nbar-6, "fill": bCe765, "fill-opacity": 0 }); }; InstructionBox.prototype.drawScrollBtn = function( bScrl) { var szHlight = "RGB(250,250,250)"; var szHshad = "RGB(24,24,24)"; var szshad = "RGB(124,124,124)"; var nbar = 18; var btnScrl = nbar - 6; var nsepx = 4; var nsepy = 3; var nx = this.wd - 4 - nsepx - btnScrl; var ny = 4 + nsepy; if( bScrl ) { draw3DRect( this.node, nx , ny, btnScrl, btnScrl, szHlight, szHshad, aEm599 ); createNode( "polygon", this.node, { "points": (nx+btnScrl/2)+","+(ny+2)+" "+(nx+2)+","+(ny+btnScrl-4)+" "+(nx+btnScrl-2)+","+(ny+btnScrl-4) }) } this.btnUp = createNode( "rect", this.node, { "x": nx, "y": ny, "width": btnScrl, "height": btnScrl, "fill": bCe765, "fill-opacity": 0 }); nx = nx - btnScrl - nsepx; if( bScrl ) { draw3DRect( this.node, nx , ny, btnScrl, btnScrl, szHlight, szHshad, aEm599 ); createNode( "polygon", this.node, { "points": (nx+btnScrl/2)+","+(ny+btnScrl-3)+" "+(nx+2)+","+(ny+3)+" "+(nx+btnScrl-2)+","+(ny+3) }) } this.btnDwn = createNode( "rect", this.node, { "x": nx, "y": ny, "width": btnScrl, "height": btnScrl, "fill": bCe765, "fill-opacity": 0 }); }; InstructionBox.prototype.calcTxtArea = function( ml, mt, mr, mb) { var nbar = 16; this.tx = 6 + ml; this.tw = this.wd - 12 - ml- mr; this.ty = nbar + 10 + mt; this.th = this.ht - 14 - nbar - mt - mb; this.cx = this.tx; this.cy = this.ty; }; InstructionBox.prototype.AddText = function( nLx823) { var tag = 0; if( nLx823.hasChildNodes() ) { var arNodes = nLx823.getElementsByTagNameNS( SBL.NAMESPACE, "*" ); for( pTxt = arNodes.item(0); pTxt; pTxt = arNodes.item(0) ) { if(pTxt.tagName == "sbl:txt" ) { this.AppendLine( pTxt.firstChild.nodeValue); nLx823.removeChild(pTxt); } } } this.svg.removeChild(this.test); }; InstructionBox.prototype.AppendLine = function( txt ) { txt = txt.substring( 1, txt.length); this.ParseString( txt); this.CreateText() }; InstructionBox.prototype.ParseString = function( str ) { this.StrLine = new Array(); var arword = new Array(); var prev = 0; var len = 0; var words = str.split(' '); while(words.length) { var word = words[0]; this.test.firstChild.data = arword.join( ' ' ) + ' ' + word; len = this.test.getComputedTextLength(); if( len > this.tw ) { if(arword.length == 0) arword.push( words.shift() ); if(!words.length) arword.push( words[0] ); this.StrLine.push( new Word( prev, arword) ); arword = new Array(); } else arword.push( words.shift() ); prev = len; if( words.length == 0 ) this.StrLine.push( new Word( 0, arword ) ); } this.test.firstChild.data = ''; }; InstructionBox.prototype.CreateText = function() { var str; var tspan; var first = 1; if( this.align != 'justify' ) { while (this.StrLine.length) { var sline; str = this.StrLine.shift(); tspan = createNode( 'tspan', this.tnode, { 'dy': this.ls } ); switch( this.align) { case 'left': tspan.setAttribute( "x", 0); this.tnode.setAttribute( "text-anchor", "start" ); break; case 'center': tspan.setAttribute( "x", this.tw/2 ); this.tnode.setAttribute( "text-anchor", "middle" ); break; case 'right': tspan.setAttribute( "x", this.tw); this.tnode.setAttribute( "text-anchor", "end" ); break; default: tspan.setAttribute( "x", 0); this.tnode.setAttribute( "text-anchor", "start" ); break; } sline = str.words.join(' '); first ++; createText( tspan, sline ); this.cy += this.fz * this.sep; } } else { while (this.StrLine.length) { str = this.StrLine.shift(); tspan = createNode( 'tspan', this.tnode, { 'dy': this.ls } ); if (!this.StrLine.length) createText( tspan, str.words.join(' ') ); else { var space = (this.tw - str.width) / (str.words.length - 1); for (var i=0; i<str.words.length; i++) { var dx = space; if ( !i ) dx = 0; var word = str.words[i] + ' '; if (i == str.words.length - 1) word = str.words[i]; var tpan = createNode( 'tspan', tspan, { 'dx': dx } ); createText( tpan, word ); } } tspan.setAttribute('x', '0'); tspan.setAttribute('dy', this.ls); this.tnode.setAttribute( 'text-anchor', 'start'); this.cy += this.fz * this.sep; } } }; InstructionBox.prototype.scrollUp = function( ) { val = parseInt(this.tnode.getAttribute("y")); if( (val+this.cy) > (this.ty+this.th) ) { val -= this.fz * this.sep; this.tnode.setAttribute("y",val); } }; InstructionBox.prototype.scrollDown = function() { val = parseInt(this.tnode.getAttribute("y")); if( val < 0 ) { val += this.fz * this.sep; this.tnode.setAttribute("y",val); } }; function textfield() { var ntp, vAu443, aNd118, uXp846, oTe818; if ( arguments.length == 2 ) { var nLx823 = arguments[0]; var parent = arguments[1]; this.id = nLx823.getAttribute( "id"); this.x = parseInt( nLx823.getAttribute( "x")); this.y = parseInt( nLx823.getAttribute( "y")); this.wd = parseInt( nLx823.getAttribute( "width")); this.ht = parseInt( nLx823.getAttribute( "height")); this.attr = parseInt( nLx823.getAttribute( "attr") ); this.co = parseInt( nLx823.getAttribute( "co") ); this.fz = parseInt(nLx823.getAttribute( "font-size") ); this.font = nLx823.getAttribute( "font"); this.fcop = nLx823.getAttribute( "font-opacity") ; this.ls = parseInt( nLx823.getAttribute( "ls")); this.fc = nLx823.getAttribute( "font-color"); this.fs = nLx823.getAttribute( "font-style"); this.fw = nLx823.getAttribute( "font-weight"); this.fill = nLx823.getAttribute( "fill"); this.fop = nLx823.getAttribute( "fill-opacity"); this.trans = nLx823.getAttribute( "transform"); this.align = "left"; ntp = nLx823.getAttribute( "tp"); vAu443 = parseInt( nLx823.getAttribute( "ml")); aNd118 = parseInt( nLx823.getAttribute( "mt")); uXp846 = parseInt( nLx823.getAttribute( "mr")); oTe818 = parseInt( nLx823.getAttribute( "mb")); this.parent = parent; } if(this.fill == "none") { this.fill = "white"; this.fop = 0; } if(!this.co) this.co = 0; if(this.co > 0 ) { if(ntp) { var stp = ntp.split(','); this.tlx = parseInt(stp[0]); this.tly = parseInt(stp[1]); } } switch( this.ls) { case 0: this.ls = "1em"; this.sep = 1; break; case 1: this.ls = "1.5em"; this.sep = 1.5; break; case 2: this.ls = "2em"; this.sep = 2; break; default: this.ls = "1em"; this.sep = 1; break; } var trans = "translate(" + this.x +"," + this.y +")"; if(this.trans) trans = this.trans + trans; this.node = createOnly( "g", this.parent, { "id": this.id, "transform": trans} ); this.parent.insertBefore( this.node, nLx823); this.calcTxtArea( vAu443, aNd118, uXp846, oTe818); this.drawBorder(); this.AddText( nLx823 ); this.node.addEventListener('click', this, false); mBt375.addEventListener('unload', this, false); }; textfield.prototype.handleEvent = function(e) { switch (e.type) { case 'unload': this.node.removeEventListener( 'click', this, false); break; case 'click': CheckFocus(this); break; default: break; } }; textfield.prototype.setFocus = function() { this.focus = true; if( !this.fcs ) this.fcs = createNode( "rect", this.node, { "x": this.tx, "y": this.ty + 2, "width": this.tw, "height": this.th - 4, "fill": "none", "stroke": "grey", "stroke-dasharray": "4,4", "pointer-events": "none"} ); else this.node.appendChild(this.fcs); }; textfield.prototype.removeFocus = function() { this.focus = false; if(this.fcs) this.node.removeChild(this.fcs); }; textfield.prototype.KeyPress = function(evt) { }; textfield.prototype.KeyDown = function(evt) { var key = evt.keyCode; switch(key) { case 38: this.scrollDown(); break; case 40: this.scrollUp(); break; default: break; } }; textfield.prototype.clearText = function() { while(this.tnode.hasChildNodes()) { var nod = this.tnode.firstChild; this.tnode.removeChild(nod); } }; textfield.prototype.calcTxtArea = function( nml, nmt, nmr, nmb) { switch( this.attr) { case 0: this.tx = 4 + nml; this.ty = 4 + nmt; this.tw = this.wd -8- nml - nmr; this.th = this.ht -8- nmt - nmb; break; case 2: case 1: this.tx = 1 + nml; this.ty = 1 + nmt; this.tw = this.wd - 2 - nml - nmr; this.th = this.ht - 2 - nmt - nmb; break; default: break; } this.cx = this.tx; this.cy = this.ty; }; textfield.prototype.drawBorder = function() { switch(this.co) { case 0: this.drawTxtRgn(); break; case 1: this.drawRectBubble(); break; case 2: this.drawRectBubble(); break; case 3: this.drawRoundedBubble(); break; case 4: this.drawCloud(); break; case 5: this.drawTxtRgn(); this.drawTailLineBorder1(); break; case 6: this.drawTxtRgn(); this.drawTailLineBorder2(); break; case 7: this.drawTxtRgn(); this.drawTailLineBorder3(); break; case 8: this.drawTxtRgn(); this.drawTailLineBorder4(); break; case 9: this.drawTxtRgn(); this.drawTailLineBar1(); break; case 10: this.drawTxtRgn(); this.drawTailLineBar2(); break; case 11: this.drawTxtRgn(); this.drawTailLineBar3(); break; case 12: this.drawTxtRgn(); this.drawTailLineBar4(); break; case 13: this.attr = 0; this.drawTxtRgn(); this.drawTailLineBorder1(); break; case 14: this.attr = 0; this.drawTxtRgn(); this.drawTailLineBorder2(); break; case 15: this.attr = 0; this.drawTxtRgn(); this.drawTailLineBorder3(); break; case 16: this.attr = 0; this.drawTxtRgn(); this.drawTailLineBorder4(); break; default: alert("Error"); break; } this.svg = createNode( "svg", this.node, { "x": this.tx, "y": this.ty, "width": this.tw, "height": this.th }); this.tnode = createNode( "text", this.svg, {"y": 0,"font-size": this.fz, "fill": this.fc, "font-family":this.font, "fill-opacity":this.fcop, "font-style":this.fs, "font-weight":this.fw, "xml:space": "preserve"} ); this.test = createNode( "text", this.svg, {"y": 0,"font-size": this.fz, "fill": this.fc, "font-family":this.font, "fill-opacity":this.fcop, "font-style":this.fs, "font-weight":this.fw, "xml:space": "preserve"} ); createText( this.test, "" ); }; textfield.prototype.drawTxtRgn = function() { var szHlight = "RGB(250,250,250)"; var szHshad = "RGB(24,24,24)"; var szshad = "RGB(124,124,124)"; switch( this.attr) { case 0: draw3DRect( this.node, 0, 0, this.wd, this.ht, aEm599, szHshad, "none"); draw3DRect( this.node, 1, 1, this.wd-2, this.ht-2, szHlight, szshad, "none"); createNode( "rect", this.node, { "x": 2, "y": 2, "width": this.wd-4,"height": this.ht-4, "stroke": aEm599, "stroke-width":2, "fill": "none" }); draw3DRect( this.node, 3, 3, this.wd-6, this.ht-6, szshad, szHlight, this.fill); this.node.getLastChild().setAttribute("fill-opacity", this.fop ); break; case 2: createNode( "rect", this.node, { "x": 0, "y": 0, "width": this.wd,"height": this.ht, "stroke": this.fc, "stroke-opacity": this.fcop, "fill": this.fill, "fill-opacity": this.fop }); break; case 1: createNode( "rect", this.node, { "x": 0, "y": 0, "width": this.wd,"height": this.ht, "fill": this.fill, "fill-opacity": this.fop }); break; default: alert("Error"); break; } }; textfield.prototype.drawRectBubble = function() { var szHlight = "RGB(250,250,250)"; var szHshad = "RGB(24,24,24)"; var szshad = "RGB(124,124,124)"; var szpth = ""; var ntax = this.tlx-this.x; var ntay = this.tly-this.y; var noffset; if( ntax <= 0 && ntay < ( this.ht / 2 )) { noffset = this.ht / 2 * 0.2; szpth = "M 0 0 h " + this.wd + " v " + this.ht + " h " + (-this.wd) + " v " + ( - ( this.ht / 2 + noffset )); szpth += " L " + ntax + "," + ntay + " L 0," + noffset + "z"; } else if( ntax <= 0 && ntay >= (this.ht/2)) { noffset = this.ht/2 * 0.2; szpth = "M 0 0 h " + this.wd + " v " + this.ht + " h " + (-this.wd) + " v " + (-noffset); szpth += " L " + ntax + "," + ntay + " L 0," + (noffset+this.ht/2) + "z"; } else if( ntax <= this.wd/2 && ntay < 0) { noffset = this.wd/2*0.2; szpth = "M 0 0 h "+noffset+" L "+ntax+","+ntay+" L "+(this.wd/2-noffset)+",0 h "+(noffset+this.wd/2); szpth += " v "+this.ht+" h "+(-this.wd)+"z"; } else if( ntax < this.wd && ntay < 0) { noffset = this.wd/2*0.2; szpth = "M 0 0 h "+(noffset+this.wd/2)+" L "+ntax+","+ntay+" L "+(this.wd-noffset)+",0 h "+noffset; szpth += " v "+this.ht+" h "+(-this.wd)+"z"; } else if( ntax <= this.wd/2 && ntay > this.ht) { noffset = this.wd/2 * 0.2; szpth = "M 0 0 h "+this.wd+" v "+this.ht+" h "+(-(this.wd/2+noffset))+" L "+ntax+","+ntay; szpth += " L "+(noffset)+","+this.ht+" h "+(-noffset)+" z"; } else if( ntax < this.wd && ntay > this.ht) { noffset = this.wd/2 * 0.2; szpth = "M 0 0 h "+this.wd+" v "+this.ht+" h "+(-noffset)+" L "+ntax+","+ntay; szpth += " L "+(this.wd/2+noffset)+","+this.ht+" h "+(-(noffset+this.wd/2))+" z"; } else if( ntax >= this.wd && ntay < (this.ht/2)) { noffset = this.ht/2 * 0.2; szpth = "M 0 0 h "+this.wd+" v "+noffset+" L "+ntax+","+ntay+" L "+this.wd+","+(this.ht/2-noffset); szpth += " v "+(this.ht/2+noffset)+" h "+(-this.wd)+" z"; } else if( ntax >= this.wd && ntay >= this.ht/2) { noffset = this.ht/2 * 0.2; szpth = "M 0 0 h "+this.wd+" v "+(this.ht/2+noffset)+" L "+ntax+","+ntay+" L "+this.wd+","+(this.ht-noffset); szpth += " v "+noffset+" h "+(-this.wd)+" z"; } switch( this.attr) { case 0: createNode( "path", this.node, { "d": szpth, "stroke": aEm599, "fill": this.fill, "stroke-width": 4, "fill-opacity": this.fop }); break; case 2: createNode( "path", this.node, { "d": szpth, "stroke": this.fc, "stroke-opacity":this.fcop, "fill": this.fill, "fill-opacity": this.fop }); break; case 1: createNode( "path", this.node, { "d": szpth,"fill": this.fill, "fill-opacity": this.fop }); break; default: break; } }; textfield.prototype.drawRoundBubble = function() { var szHshad = "RGB(24,24,24)"; drawEllipse( this.node, 0, 0, this.wd, this.ht, this.fill, szHshad); }; textfield.prototype.drawRoundedBubble = function() { var szHlight = "RGB(250,250,250)"; var szHshad = "RGB(24,24,24)"; var szlight = "RGB(230,200,230)"; var szshad = "RGB(124,124,124)"; var ncoff = 15; var szpth=""; var ntax = this.tlx-this.x; var ntay = this.tly-this.y; var noffset; if( ntax <= 0 && ntay < (this.ht/2)) { noffset = this.ht/2 * 0.2; szpth = "M"+ncoff+" 0 h "+(this.wd-2*ncoff)+" Q "+this.wd+",0 "+this.wd+","+ncoff+" v "+(this.ht-2*ncoff); szpth += " Q "+this.wd+","+this.ht+" "+(this.wd-ncoff)+","+this.ht; szpth += " h "+(-this.wd+2*ncoff)+" Q 0"+","+this.ht+" 0,"+(this.ht-ncoff); szpth += " v "+(-(this.ht/2+noffset))+" L "+ntax+","+ntay; if( noffset > ncoff ) szpth += " L 0,"+noffset+" v "+(-(noffset-ncoff))+" Q 0,0 "+ncoff+",0"; else szpth += " L 0,"+noffset+" Q 0,0 "+ncoff+",0"; } else if( ntax <= 0 && ntay >= (this.ht/2)) { noffset = this.ht/2 * 0.2; szpth = "M"+ncoff+" 0 h "+(this.wd-2*ncoff)+" Q "+this.wd+",0 "+this.wd+","+ncoff+" v "+(this.ht-2*ncoff); szpth += " Q "+this.wd+","+this.ht+" "+(this.wd-ncoff)+","+this.ht; if(noffset>ncoff) szpth += " h "+(-this.wd+2*ncoff)+" Q 0"+","+this.ht+" 0,"+(this.ht-ncoff)+" v"+(ncoff-noffset); else szpth += " h "+(-this.wd+2*ncoff)+" Q 0"+","+this.ht+" 0,"+(this.ht-ncoff); szpth += " L "+ntax+","+ntay+" L 0,"+(noffset+this.ht/2)+" v "+(-(this.ht/2+noffset-ncoff)); szpth += " Q 0,0 "+ncoff+",0"; } else if( ntax <= this.wd/2 && ntay < 0) { noffset = this.wd/2 * 0.2; if(noffset>ncoff) szpth = "M"+ncoff+" 0 h "+(noffset-ncoff)+" L "+ntax+","+ntay+" L "+(this.wd/2-noffset)+",0 h "+(noffset+this.wd/2-ncoff); else szpth = "M"+ncoff+" 0 h "+ncoff+" L "+ntax+","+ntay+" L "+(this.wd/2-noffset)+",0 h "+(noffset+this.wd/2-ncoff); szpth += " Q "+this.wd+",0 "+this.wd+","+ncoff+" v "+(this.ht-2*ncoff); szpth += " Q "+this.wd+","+this.ht+" "+(this.wd-ncoff)+","+this.ht+" h "+(-this.wd+2*ncoff); szpth += " Q 0"+","+this.ht+" 0,"+(this.ht-ncoff)+" v"+(-this.ht+2*ncoff)+" Q 0,0 "+ncoff+",0"; } else if( ntax < this.wd && ntay < 0) { noffset = this.wd/2 * 0.2; if(noffset>ncoff) szpth = "M"+ncoff+" 0 h "+(noffset+this.wd/2-ncoff)+" L "+ntax+","+ntay+" L "+(this.wd-noffset)+",0 h "+(noffset-ncoff); else szpth = "M"+ncoff+" 0 h "+(noffset+this.wd/2-ncoff)+" L "+ntax+","+ntay+" L "+(this.wd-noffset)+",0 h "+(ncoff-noffset); szpth += " Q "+this.wd+",0 "+this.wd+","+ncoff+" v "+(this.ht-2*ncoff); szpth += " Q "+this.wd+","+this.ht+" "+(this.wd-ncoff)+","+this.ht+" h "+(-this.wd+2*ncoff); szpth += " Q 0"+","+this.ht+" 0,"+(this.ht-ncoff)+" v"+(-this.ht+2*ncoff)+" Q 0,0 "+ncoff+",0"; } else if( ntax <= this.wd/2 && ntay > this.ht) { noffset = this.wd/2 * 0.2; szpth = "M"+ncoff+" 0 h "+(this.wd-2*ncoff)+" Q "+this.wd+",0 "+this.wd+","+ncoff+" v "+(this.ht-2*ncoff); szpth += " Q "+this.wd+","+this.ht+" "+(this.wd-ncoff)+","+this.ht; if(noffset>ncoff) szpth += " h "+(-(this.wd/2+noffset-ncoff))+" L "+ntax+","+ntay+" L "+(noffset)+","+this.ht+" h "+(-noffset+ncoff); else szpth += " h "+(-(this.wd/2+noffset-ncoff))+" L "+ntax+","+ntay+" L "+(noffset)+","+this.ht+" h "+(noffset-ncoff); szpth += " Q 0"+","+this.ht+" 0,"+(this.ht-ncoff)+" v"+(-this.ht+2*ncoff)+" Q 0,0 "+ncoff+",0"; } else if( ntax < this.wd && ntay > this.ht) { noffset = this.wd/2 * 0.2; szpth = "M"+ncoff+" 0 h "+(this.wd-2*ncoff)+" Q "+this.wd+",0 "+this.wd+","+ncoff+" v "+(this.ht-2*ncoff); szpth += " Q "+this.wd+","+this.ht+" "+(this.wd-ncoff)+","+this.ht; if(noffset>ncoff) szpth += " h "+(-noffset+ncoff)+" L "+ntax+","+ntay+" L "+(this.wd/2+noffset)+","+this.ht+" h "+(-(this.wd/2+noffset-ncoff)); else szpth += " h "+(noffset-ncoff)+" L "+ntax+","+ntay+" L "+(this.wd/2+noffset)+","+this.ht+" h "+(-(this.wd/2+noffset-ncoff)); szpth += " Q 0"+","+this.ht+" 0,"+(this.ht-ncoff)+" v"+(-this.ht+2*ncoff)+" Q 0,0 "+ncoff+",0"; } else if( ntax >= this.wd && ntay < (this.ht/2)) { noffset = this.ht/2 * 0.2; szpth = "M"+ncoff+" 0 h "+(this.wd-2*ncoff)+" Q "+this.wd+",0 "+this.wd+","+ncoff; if(noffset>ncoff) szpth += " v "+(noffset-ncoff)+" L "+ntax+","+ntay+" L "+this.wd+","+(this.ht/2-noffset)+" v "+(this.ht/2+noffset-ncoff); else szpth += " v "+(ncoff-noffset)+" L "+ntax+","+ntay+" L "+this.wd+","+(this.ht/2-noffset)+" v "+(this.ht/2+noffset-ncoff); szpth += " Q "+this.wd+","+this.ht+" "+(this.wd-ncoff)+","+this.ht; szpth += " h "+(-this.wd+2*ncoff)+" Q 0"+","+this.ht+" 0,"+(this.ht-ncoff)+" v"+(-this.ht+2*ncoff)+" Q 0,0 "+ncoff+",0"; } else if( ntax >= this.wd && ntay >= this.ht/2) { noffset = this.ht/2 * 0.2; szpth = "M"+ncoff+" 0 h "+(this.wd-2*ncoff)+" Q "+this.wd+",0 "+this.wd+","+ncoff; if(noffset>ncoff) szpth += " v "+(this.ht/2+noffset-ncoff)+" L "+ntax+","+ntay+" L "+this.wd+","+(this.ht-noffset)+" v "+(noffset-ncoff); else szpth += " v "+(this.ht/2+noffset-ncoff)+" L "+ntax+","+ntay+" L "+this.wd+","+(this.ht-noffset)+" v "+(ncoff-noffset); szpth += " Q "+this.wd+","+this.ht+" "+(this.wd-ncoff)+","+this.ht; szpth += " h "+(-this.wd+2*ncoff)+" Q 0"+","+this.ht+" 0,"+(this.ht-ncoff)+" v"+(-this.ht+2*ncoff)+" Q 0,0 "+ncoff+",0"; } switch( this.attr) { case 0: createNode( "path", this.node, { "d": szpth, "stroke": aEm599, "fill": this.fill, "stroke-width": 4, "fill-opacity": this.fop }); break; case 2: createNode( "path", this.node, { "d": szpth, "stroke": this.fc, "stroke-opacity":this.fcop, "fill": this.fill, "fill-opacity": this.fop }); break; case 1: createNode( "path", this.node, { "d": szpth, "fill": this.fill, "fill-opacity": this.fop }); break; default: break; } }; textfield.prototype.drawCloud = function() { this.drawTxtRgn(); }; textfield.prototype.drawTailLineBorder1 = function() { var szHshad = "RGB(24,24,24)"; var szpth=""; var ntax = this.tlx-this.x; var ntay = this.tly-this.y; if(ntax<0) szpth = "M 0,"+this.ht/2+" h "+ntax; else if(ntax>this.wd) szpth = "M"+this.wd+","+this.ht/2+" h "+(ntax-this.wd); createNode( "path", this.node, { "d": szpth, "stroke": szHshad, "stroke-width": 2}); }; textfield.prototype.drawTailLineBorder2 = function() { var szHshad = "RGB(24,24,24)"; var szpth=""; var ntax = this.tlx-this.x; var ntay = this.tly-this.y; if(ntax<0) szpth = "M 0,"+this.ht/2+" L "+ntax+","+ntay; else if(ntax>this.wd) szpth = "M"+this.wd+","+this.ht/2+" L "+ntax+","+ntay; createNode( "path", this.node, { "d": szpth, "stroke": szHshad, "stroke-width": 4}); }; textfield.prototype.drawTailLineBorder3 = function() { var szHshad = "RGB(24,24,24)"; var szpth=""; var ntax = this.tlx-this.x; var ntay = this.tly-this.y; var noffset; if(ntax<0) { noffset = Math.abs(ntax)*0.3; szpth = "M 0,"+this.ht/2+" h "+(-noffset)+" L "+ntax+","+ntay; } else if(ntax>this.wd) { noffset = (ntax-this.wd)*0.3; szpth = "M"+this.wd+","+this.ht/2+" h "+noffset+" L "+ntax+","+ntay; } createNode( "path", this.node, { "d": szpth, "stroke": szHshad, "stroke-width": 4, "fill": "none"}); }; textfield.prototype.drawTailLineBorder4 = function() { var szHshad = "RGB(24,24,24)"; var szpth = ""; var ntax = this.tlx-this.x; var ntay = this.tly-this.y; var noffset,noffset1; if(ntax<0) { noffset = Math.abs(ntax)*0.33; noffset1 = (ntay-this.ht/2)/2; szpth = "M 0,"+this.ht/2+" h "+(-noffset)+" L "+ntax+","+(this.ht/2+noffset1)+" v "+noffset1; } else if(ntax>this.wd) { noffset = (ntax-this.wd) * 0.33; noffset1 = (ntay-this.ht/2)/2; szpth = "M"+this.wd+","+this.ht/2+" h "+noffset+" L "+ntax+","+(this.ht/2+noffset1)+" v "+noffset1; } createNode( "path", this.node, { "d": szpth, "stroke": szHshad, "stroke-width": 4, "fill": "none"}); }; textfield.prototype.drawTailLineBar1 = function() { var szHshad = "RGB(24,24,24)"; var szpth = ""; var ntax = this.tlx - this.x; var ntay = this.tly - this.y; if( ntax < 0 ) { szpth = "M -2," + this.ht/2 + " h " + ntax; createNode( "line", this.node, { "x1": -4, "y1": 0, "x2": -4, "y2": this.ht, "stroke": szHshad, "stroke-width": 4}); } else if( ntax > this.wd) { szpth = "M" + (this.wd + 4) + "," + (this.ht/2 + 2) + " h " + (ntax - this.wd); createNode( "line", this.node, { "x1": this.wd+4, "y1": 0, "x2": this.wd+4, "y2": this.ht, "stroke": szHshad, "stroke-width": 4}); } createNode( "path", this.node, { "d": szpth, "stroke": szHshad, "stroke-width": 2}); }; textfield.prototype.drawTailLineBar2 = function() { var szHshad = "RGB(24,24,24)"; var szpth = ""; var ntax = this.tlx - this.x; var ntay = this.tly - this.y; if( ntax < 0 ) { szpth = "M -2," + this.ht/2 + " L " + ntax + "," + ntay; createNode( "line", this.node, { "x1": -4, "y1": 0, "x2": -4, "y2": this.ht, "stroke": szHshad, "stroke-width": 4}); } else if( ntax > this.wd) { szpth = "M" + (this.wd + 4) + "," + this.ht/2 + " L " + ntax + "," + ntay; createNode( "line", this.node, { "x1": this.wd + 4, "y1": 0, "x2": this.wd + 4, "y2": this.ht, "stroke": szHshad, "stroke-width": 4}); } createNode( "path", this.node, { "d": szpth, "stroke": szHshad, "stroke-width": 4}); }; textfield.prototype.drawTailLineBar3 = function() { var szHshad = "RGB(24,24,24)"; var szpth = ""; var ntax = this.tlx - this.x; var ntay = this.tly - this.y; var noffset; if( ntax < 0 ) { noffset = Math.abs( ntax ) * 0.3; szpth = "M -2," + this.ht/2 + " h " + (-noffset) + " L " + ntax + "," + ntay; createNode( "line", this.node, { "x1": -4, "y1": 0, "x2": -4, "y2": this.ht, "stroke": szHshad, "stroke-width": 4}); } else if( ntax > this.wd ) { noffset = ( ntax - this.wd) * 0.3; szpth = "M"+ (this.wd + 4) + "," + this.ht/2 + " h " + noffset + " L " + ntax + "," + ntay; createNode( "line", this.node, { "x1": this.wd+4, "y1": 0, "x2": this.wd+4, "y2": this.ht, "stroke": szHshad, "stroke-width": 4}); } createNode( "path", this.node, { "d": szpth, "stroke": szHshad, "stroke-width": 4, "fill": "none"}); }; textfield.prototype.drawTailLineBar4 = function() { var szHshad = "RGB(24,24,24)"; var szpth = ""; var ntax = this.tlx - this.x; var ntay = this.tly - this.y; var noffset,noffset1; if( ntax < 0 ) { noffset = Math.abs(ntax) * 0.33; noffset1 = (ntay - this.ht/2) / 2; szpth = "M -2," + this.ht/2 + " h " + (-noffset) + " L " + ntax + "," + (this.ht/2 + noffset1) + " v " + noffset1; createNode( "line", this.node, { "x1": -4, "y1": 0, "x2": -4, "y2": this.ht, "stroke": szHshad, "stroke-width": 4}); } else if( ntax > this.wd ) { noffset = (ntax-this.wd) * 0.33; noffset1 = ( ntay - this.ht/2) / 2; szpth = "M"+ (this.wd + 4) + "," + this.ht/2 + " h " + noffset + " L " + ntax + "," + (this.ht/2 + noffset1) + " v " + noffset1; createNode( "line", this.node, { "x1": this.wd+4, "y1": 0, "x2": this.wd+4, "y2": this.ht, "stroke": szHshad, "stroke-width": 4}); } createNode( "path", this.node, { "d": szpth, "stroke": szHshad, "stroke-width": 4, "fill": "none"}); }; textfield.prototype.AddText = function( nLx823) { if( nLx823.hasChildNodes() ) { var arNodes = nLx823.getElementsByTagNameNS( SBL.NAMESPACE, "*" ); for( pTxt = arNodes.item(0); pTxt; pTxt = arNodes.item(0) ) { if(pTxt.tagName == "sbl:txt" ) { this.AppendLine( pTxt.firstChild.nodeValue); nLx823.removeChild(pTxt); } } } this.svg.removeChild(this.test); }; textfield.prototype.AppendLine = function( txt ) { txt = txt.substring( 1, txt.length); this.ParseString( txt); this.CreateText(); }; textfield.prototype.ParseString = function( str ) { this.StrLine = new Array(); var arword = new Array(); var prev = 0; var len = 0; var words = str.split( ' '); while(words.length) { var word = words[0]; this.test.firstChild.data = arword.join( ' ' ) + " " +word; len = this.test.getComputedTextLength(); if( len > this.tw ) { if(arword.length == 0) arword.push( words.shift() ); if(!words.length) arword.push( words[0] ); this.StrLine.push( new Word( prev, arword) ); arword = new Array(); } else arword.push( words.shift() ); prev = len; if( words.length == 0 ) this.StrLine.push( new Word( 0, arword ) ); } }; textfield.prototype.CreateText = function() { var str; var tspan; if( this.align != 'justify' ) { while (this.StrLine.length) { str = this.StrLine.shift(); tspan = createNode( 'tspan', this.tnode, { 'dy': this.ls } ); switch( this.align) { case 'left': tspan.setAttribute( "x", 0); this.tnode.setAttribute( "text-anchor", "start" ); break; case 'center': tspan.setAttribute( "x", this.tw/2 ); this.tnode.setAttribute( "text-anchor", "middle" ); break; case 'right': tspan.setAttribute( "x", this.tw); this.tnode.setAttribute( "text-anchor", "end" ); break; default: tspan.setAttribute( "x", 0); this.tnode.setAttribute( "text-anchor", "start" ); break; } createText( tspan, str.words.join(' ') ); this.cy += this.fz * this.sep; } } else { while (this.StrLine.length) { str = this.StrLine.shift(); tspan = createNode( 'tspan', this.tnode, { 'dy': this.ls } ); if (!str.length) createText( tspan, str.words.join(' ') ); else { var space = (this.tw - str.width) / (str.words.length - 1); for (var i=0; i<str.words.length; i++) { var dx = space; if ( !i ) dx = 0; var word = str.words[i] + ' '; if (i == str.words.length - 1) word = str.words[i]; var tpan = createNode( 'tspan', tspan, { 'dx': dx } ); createText( tpan, word ); } } tspan.setAttribute('x', '0'); tspan.setAttribute('dy', this.ls); this.tnode.setAttribute( 'text-anchor', 'start'); this.cy += this.fz * this.sep; } } }; textfield.prototype.scrollUp = function( ) { val = parseInt(this.tnode.getAttribute("y")); if( (val+this.cy) > (this.ty+this.th)) { val -= this.fz * this.sep; this.tnode.setAttribute("y",val); } }; textfield.prototype.scrollDown = function() { val = parseInt(this.tnode.getAttribute("y")); if( val < 0 ) { val += this.fz * this.sep; this.tnode.setAttribute("y",val); } }; function Word( width, words ) { this.width = width; this.words = words; }; function ValField() { var vAu443, aNd118, uXp846, oTe818, nLx823, parent; if ( arguments.length == 2 ) { nLx823 = arguments[0]; parent = arguments[1]; this.id = nLx823.getAttribute( "id"); this.x = parseInt( nLx823.getAttribute( "x")); this.y = parseInt( nLx823.getAttribute( "y")); this.wd = parseInt( nLx823.getAttribute( "width")); this.ht = parseInt( nLx823.getAttribute( "height")); this.attr = parseInt( nLx823.getAttribute( "attr")); this.cl = parseInt( nLx823.getAttribute( "cl")); this.cse = parseInt( nLx823.getAttribute( "cs")); this.dg = parseInt( nLx823.getAttribute( "dg")); this.pas = parseInt( nLx823.getAttribute( "pass")); this.ls = parseInt( nLx823.getAttribute( "ls")); this.font = nLx823.getAttribute( "font"); this.fz = parseInt( nLx823.getAttribute( "font-size")); this.fs = parseInt( nLx823.getAttribute( "fs")); this.fill = nLx823.getAttribute( "fill"); this.fc = nLx823.getAttribute( "font-color"); this.fcop = nLx823.getAttribute( "font-opacity"); this.fs = nLx823.getAttribute( "font-style"); this.fw = nLx823.getAttribute( "font-weight"); this.trans = nLx823.getAttribute( "transform"); this.tmout = nLx823.getAttribute( "timeout"); this.tgt = parseInt( nLx823.getAttribute( "target")); vAu443 = parseInt( nLx823.getAttribute( "ml")); aNd118 = parseInt( nLx823.getAttribute( "mt")); uXp846 = parseInt( nLx823.getAttribute( "mr")); oTe818 = parseInt( nLx823.getAttribute( "mb")); } if(this.fill == "none") { this.fill = "white"; this.fop = 0; } var trans = "translate(" + this.x +"," + this.y +")"; if(this.trans) trans = this.trans + trans; this.node = createOnly( "g", parent, { "id": this.id, "transform": trans} ); parent.insertBefore( this.node, nLx823); this.calcCanvas( vAu443, aNd118, uXp846, oTe818); this.drawCanvas(); this.cur = this.Cursor(); this.curspan = null; this.tscount = 0; this.curY = 0; this.curpos = 0; this.cx = 0; this.cy = 0; this.focus = false; this.timeVal = null; var cmat = this.tnode.getCTM(); this.CTMx = cmat.e; this.CTMy = cmat.f; if( nLx823.hasChildNodes ) this.parseValString(nLx823); else if(!nLx823.hasChildNodes) this.valstr = null; this.pchar = '*'; this.node.addEventListener( 'keypress', this, false); this.node.addEventListener( 'keydown', this, false); this.node.addEventListener( 'mousedown', this, false); this.node.addEventListener( 'mouseover', this, false); this.node.addEventListener( 'mouseout', this, false); this.node.addEventListener( 'click', this, false); xKw452.rootElement.addEventListener( 'unload', this, false); if(this.tmout && this.tmout > 0) ValTimeOut( this.tmout, this); }; ValField.prototype.parseValString = function(parent) { this.valstr = new Array(); var tf = parent.getElementsByTagNameNS( SBL.NAMESPACE, "*"); for( var t = tf.item(0); t; t = tf.item(0)) { tname = t.getTagName().replace(/^[^:]+:/, ""); if( tname == 'valStr') this.valstr[this.valstr.length] = new ValStr( t); else if( tname == 'valTimeOut' ) this.timeVal = new ValKey(t); parent.removeChild( t); } }; ValField.prototype.handleEvent = function(e) { switch( e.type) { case 'unload': this.node.removeEventListener( 'mousedown', this, false); this.node.removeEventListener( 'click', this, false); this.node.removeEventListener( 'mouseover', this, false); this.node.removeEventListener( 'mouseout', this, false); break; case 'keypress': break; case'keydown': break; case 'mousedown': this.mouseDown(e); break; case 'click': CheckFocus(this); break; case 'mouseover': this.disableContextMenu(); break; case 'mouseout': this.enableContextMenu(); break; default: break; } }; ValField.prototype.mouseDown = function(e) { var trg = e.getTarget(); if(trg.tagName == "tspan") { this.curspan = trg; this.curpos = 0; this.check(); this.UpdateCursor(); } }; ValField.prototype.calcCanvas = function( nlft, ntp, nrt, nbtm) { switch( this.attr) { case 0: this.tx = 4 + nlft; this.ty = 4 + ntp; this.tw = this.wd - 8 - nlft - nrt; this.th = this.ht - 8 - ntp - nbtm; break; case 2: case 1: this.tx = 1 + nlft; this.ty = 1 + ntp; this.tw = this.wd - 2 - nlft - nrt; this.th = this.ht - 2 - ntp - nbtm; break; default: break; } switch(this.ls) { case 0: this.sep = this.fz; break; case 1: this.sep = this.fz * 1.5; break; case 2: this.sep = this.fz * 2.0; break; } }; ValField.prototype.drawCanvas = function() { var szHlight = "RGB(250,250,250)"; var szHshad = "RGB(24,24,24)"; var szshad = "RGB(124,124,124)"; var szAng; var nOff = 12; var nft = 3; switch( this.attr) { case 0: draw3DRect( this.node, 0, 0, this.wd, this.ht, aEm599, szHshad, "none"); draw3DRect( this.node, 1, 1, this.wd-2, this.ht-2, szHlight, szshad, "none"); createNode( "rect", this.node, { "x": 2, "y": 2, "width": this.wd-4,"height": this.ht-4, "stroke": aEm599, "stroke-width":2, "fill":"none"}); draw3DRect( this.node, 3, 3, this.wd-6, this.ht-6, szshad, szHlight, this.fill); break; case 2: createNode( "rect", this.node, { "x": 0, "y": 0, "width": this.wd,"height": this.ht, "stroke": szshad, "fill": this.fill}); break; case 1: createNode( "rect", this.node, { "x": 0, "y": 0, "width": this.wd,"height": this.ht, "fill": this.fill}); break; default: alert( "Attribute cannot be" + this.attr ); break; } this.svg = createNode( "svg", this.node, { "x": this.tx-1, "y": this.ty, "width": this.tw+2,"height": this.th}); this.tnode = createNode( "text", this.svg, { "x": 0, "y": 0, "font-size": this.fz, "fill": this.fc, "fill": this.fc, "fill-opacity":this.fcop, "font-style":this.fs, "font-weight":this.fw, "font-family": this.font, "xml:space": "preserve"} ); this.tnode.xRange = [ 0, this.tw]; this.tnode.yRange = [ 0, this.th]; if(this.pas == 1) { var df = createNode("def", this.node, {}); this.buff = createText( df, ""); this.bcnt = 0; } }; ValField.prototype.Cursor = function() { var curcol = "RGB( 0, 0, 0)"; var str = this.fill.split(" "); if(parseInt(str[1])<100 && parseInt(str[2])<100 && parseInt(str[3])<100) curcol = "RGB( 255, 255, 255)"; var tran = "translate( "+this.cx+","+this.cy+")"; var id = this.id+"cursor"; var szpth = "M 0,2 v "+this.fz; var cr = createNode( "path", this.svg, { "id": id, "d": szpth, "display": "none", "stroke": curcol, "stroke-width": 2, "transform": tran, "visibility": "visible"}); st = createNode( "animate", cr, { "attributeName": "visibility", "attributeType": "XML", "values":"visible;hidden;visible", "dur": 1, "repeatCount": "indefinite"} ); return cr; }; ValField.prototype.setFocus = function() { this.focus = true; this.cur.setAttribute( "display", "inline"); }; ValField.prototype.removeFocus = function() { this.focus = false; this.cur.setAttribute( "display", "none"); }; ValField.prototype.checkForVal = function(e) { var byDk483 = false; var nmod = 0; var key = e.keyCode; if(e.keyCode == 8) key = 46; if(key == 0) key = e.charCode; this.chkval = null; if(e.altKey == true) nmod |= 4; if(e.ctrlKey == true) nmod |= 2; if(e.shiftKey == true) nmod |= 1; if( this.valstr != null ) { for(var i=0; i<this.valstr.length; i++) { for(var j=0; j<this.valstr[i].vkey.length; j++) { if(this.valstr[i].vkey[j].key == key && this.valstr[i].vkey[j].kMod == nmod) { this.chkval = i; this.chkkey = j; this.Validate(); byDk483 = true; break; } } } } return byDk483; }; ValField.prototype.Validate = function() { var sztxt = this.getText(); var vstr = this.valstr[this.chkval]; var vtxt = vstr.str; var vky = vstr.vkey[this.chkkey]; if(this.cse != 1) { sztxt = sztxt.toLowerCase(); vtxt = vtxt.toLowerCase(); } if( vtxt == sztxt ) { if(vky != null) { this.vakey = vky; if(vky.vMsg) showMsg( vky.vIco, vky.vCap, vky.vMsg, this, 1); else if(vky.vImg) showImg(vky.vImg, this, 1); else this.OnValidation(1); } } else { if(vky != null) { if(vky.erMsg) showMsg( vky.erIco, vky.erCap, vky.erMsg, this, 0); } } }; ValField.prototype.OnValidationTarget = function() { var byDk483 = false; var sztxt = this.getText(); if(this.cse != 1) sztxt = sztxt.toLowerCase(); for( j=0; j<this.valstr.length; j++ ) { var szvtxt = this.valstr[j].str; if(this.cse != 1) szvtxt = szvtxt.toLowerCase(); if( sztxt == szvtxt) byDk483 = true; } return byDk483; }; ValField.prototype.OnValidation = function( state) { if( state == 1 && this.vakey ) { if(this.vakey.gt) { if(this.tgt) browserEval( "window.open( \"" + this.vakey.gt + "\")"); else browserEval( "window.location = \"" + this.vakey.gt + "\" "); } if(this.vakey.play) { if(this.tgt) browserEval( "window.open(\"" + this.vakey.play + "\")"); else browserEval( "window.location = \"" + this.vakey.play + "\" "); } } }; ValField.prototype.getText = function() { var szxt = ""; for( var node=this.tnode.firstChild; node; node = node.nextSibling) { szxt = szxt + node.firstChild.data; } if( this.pas == 1) szxt = this.buff.data; return szxt; }; ValField.prototype.KeyPress = function(evt) { var sztxt = this.getText(); var ln = sztxt.length; if( this.cl > 0 && this.cl == ln ) return; if( g_checkVal ) { var cc = evt.charCode; if( cc >= 32 && cc<=127) { var ch = String.fromCharCode( cc); this.Insert(ch); this.check(); this.UpdateCursor(); } } }; var g_checkVal; ValField.prototype.KeyDown = function(evt) { g_checkVal = false; if( !this.checkForVal(evt) ) { var code = evt.keyCode; g_checkVal = true; switch( code) { case 37: if(this.curspan) { if( !this.curspan.previousSibling && this.curpos == 0) break; this.goprev(); } break; case 39: if(this.curspan) { if( this.curspan.nextSibling && this.curpos > this.curspan.firstChild.data.length) break; this.gonext(); } break; case 8: if(this.curspan) { if( !this.curspan.previousSibling && this.curpos == 0) break; this.goprev(); this.del(); } break; case 127: if(this.curspan) this.del(); break; case 13: this.newLine(); this.check(); this.UpdateCursor(); break; case 36: if(this.curspan) { if(this.pas == 1) this.bcnt -= this.curpos; this.curpos = 0; this.check(); this.UpdateCursor(); } break; case 35: if(this.curspan) { if(this.pas == 1) { this.bcnt -= this.curpos; this.bcnt += this.curspan.firstChild.data.length; } this.curpos = this.curspan.firstChild.data.length; this.check(); this.UpdateCursor(); } break; case 38: if(this.curspan) { if(this.pas == 1) { if( this.curspan.previousSibling) { if(this.curpos > this.curspan.previousSibling.firstChild.data.length) this.bcnt -= this.curpos; else this.bcnt -= this.curspan.previousSibling.firstChild.data.length; } } if( this.curspan.previousSibling) { this.curspan = this.curspan.previousSibling; if(this.curpos > this.curspan.firstChild.data.length ) this.curpos = this.curspan.firstChild.data.length; this.check(); this.UpdateCursor(); } } break; case 40: if(this.curspan) { if(this.pas == 1) { if( this.curspan.nextSibling) { if(this.curpos > this.curspan.nextSibling.firstChild.data.length) { this.bcnt += this.curspan.nextSibling.firstChild.data.length; this.bcnt += (this.curspan.firstChild.data.length-this.curpos); } else this.bcnt += (this.curspan.firstChild.data.length-this.curpos); } } if( this.curspan.nextSibling) { this.curspan = this.curspan.nextSibling; if(this.curpos > this.curspan.firstChild.data.length) this.curpos = this.curspan.firstChild.data.length; this.check(); this.UpdateCursor(); } } break; default: break; } } }; ValField.prototype.Insert = function(ch) { if( !this.curspan) { this.curspan = createNode( "tspan", this.tnode, { "dy": this.fz} ); txt = this.tnode.ownerDocument.createTextNode(""); this.curspan.appendChild(txt); this.tscount++; } if(this.pas == 1) { this.buff.insertData(this.bcnt, ch); this.bcnt += ch.length; var chr = ""; for(var i=0; i<ch.length; i++) chr += this.pchar; this.curspan.firstChild.insertData(this.curpos, chr); } else this.curspan.firstChild.insertData(this.curpos, ch); this.curpos += ch.length; }; ValField.prototype.newLine = function () { var newtxt; this.Insert('\n'); this.tscount++; var ts = xKw452.createElement("tspan"); ts.setAttribute( "x", 0); ts.setAttribute( "dy", this.sep); if( this.curpos > this.curspan.firstChild.data.length) newTxt = xKw452.createTextNode(""); else newTxt = this.curspan.firstChild.splitText(this.curpos); ts.appendChild( newTxt); if( !this.curspan.nextSibling ) this.tnode.appendChild( ts); else this.tnode.insertBefore( ts, this.curspan.nextSibling); this.curpos = 0; this.curspan = ts; }; ValField.prototype.del = function() { var ch = this.curspan.firstChild.data.charAt(this.curpos); this.curspan.firstChild.deleteData( this.curpos,1); if( ch == '\n') { this.tscount--; ndat = this.curspan.nextSibling.firstChild.data; this.tnode.removeChild( this.curspan.nextSibling); this.curspan.firstChild.insertData( this.curpos, ndat); } if(this.pas == 1) this.buff.deleteData( this.bcnt,1); }; ValField.prototype.goprev = function() { this.curpos--; if(this.curpos < 0 && this.curspan.previousSibling) { this.curspan = this.curspan.previousSibling; this.curpos = this.curspan.firstChild.data.length; } this.check(); this.UpdateCursor(); if(this.pas == 1) this.bcnt--; }; ValField.prototype.gonext = function() { this.curpos++; if(this.curpos >= this.curspan.firstChild.data.length && this.curspan.nextSibling) { this.curspan = this.curspan.nextSibling; this.curpos = 0; } else if( this.curpos > this.curspan.firstChild.data.length && !this.curspan.nextSibling) this.curpos--; this.check(); this.UpdateCursor(); if(this.pas == 1) this.bcnt++; }; ValField.prototype.check = function() { var pt; var cnode = this.curspan.firstChild; if( cnode.data == "") { var cnod = this.curspan; var tot=0; pt = mBt375.createSVGPoint(); pt.x = 1; if( !this.curspan.nextSibling) tot = (this.tscount-1) * this.sep + this.fz; else { while( cnod.previousSibling) { tot += this.sep; cnod = cnod.previousSibling; } tot -= 0.4 * this.fz; } pt.y = tot; } else if( this.curpos > 0) pt = this.curspan.getEndPositionOfChar(this.curpos-1); else { pt = mBt375.createSVGPoint(); pt.x = 1; pt.y = this.curspan.getStartPositionOfChar(1).y; } var ctfx, ctfy; var cmat = this.tnode.getCTM(); ctfx = cmat.e - this.CTMx; ctfy = cmat.f - this.CTMy; if( this.tnode.xRange) { var dx=0; if( (pt.x + ctfx) > this.tnode.xRange[1] ) dx = this.tnode.xRange[1] - pt.x; else if( (ctfx + pt.x) < this.tnode.xRange[0]) dx = this.tnode.xRange[0] - pt.x; if( dx != 0) this.tnode.setAttribute( "transform", "translate("+dx+","+ctfy+")"); } if( this.tnode.yRange) { var dy=0; if( (pt.y+ctfy) > this.tnode.yRange[1]) dy = ctfy - this.sep; else if( (pt.y+ctfy) < this.tnode.yRange[0]) dy = ctfy + this.sep; if( dy != 0) this.tnode.setAttribute( "transform", "translate("+ctfx+","+dy+")"); } }; ValField.prototype.UpdateCursor = function() { var mx, my; if( this.curspan) { if( this.curpos > 0) { mx = this.curspan.getEndPositionOfChar(this.curpos-1).x; my = this.curspan.getEndPositionOfChar(this.curpos-1).y; } else { mx = 1; { var tot=0; var cnod = this.curspan.nextSibling; if( !cnod ) { tot = (this.tscount - 1) * this.sep + this.fz; } else { while( cnod.previousSibling) { tot += this.sep; cnod = cnod.previousSibling; } tot -= 0.4 * this.fz; } my = tot; } } var ctfx, ctfy; var cmat = this.tnode.getCTM(); ctfx = cmat.e - this.CTMx; ctfy = cmat.f - this.CTMy; this.cx = ctfx + mx; this.cy = ctfy + my - this.fz; } else { this.cx = 0; this.cy = this.fz; } var tran = "translate( "+this.cx+","+this.cy+")"; this.cur.setAttribute( "transform", tran); }; ValField.prototype.clear = function() { var cnod = this.tnode.firstChild; if( cnod) { while( cnod) { cnod.removeChild( cnod.firstChild); this.tnode.removeChild(cnod); cnod = this.tnode.firstChild; } this.curspan = null; this.curpos = 0; this.UpdateCursor(); } }; ValField.prototype.createContextMenu = function() { this.menu = xKw452.getElementById("val_cmenu"); if( !this.menu ) { var df = createNode("menu", this.node.ownerDocument.rootElement, {} ); this.menu = createNode("menu", df, {"id": "val_cmenu"}); } }; ValField.prototype.disableContextMenu = function() { contextMenu.firstChild.setAttribute("display", "none"); }; ValField.prototype.enableContextMenu = function() { contextMenu.firstChild.setAttribute("display", "inline"); }; function ValStr(parent) { this.str = parent.getAttribute("str"); this.kcnt = parseInt(parent.getAttribute("keyCnt")); this.vkey = new Array(); var tf = parent.getElementsByTagNameNS( SBL.NAMESPACE, "*"); for( var t = tf.item(0); t; t = tf.item(0)) { tname = t.getTagName().replace(/^[^:]+:/, ""); if( tname == 'valKey') this.vkey[this.vkey.length] = new VKey( t); parent.removeChild( t); } }; function VKey(parent) { this.key = parseInt(parent.getAttribute("key")); this.kMod = parseInt(parent.getAttribute("keyMod")); this.vImg = parent.getAttribute("valImg"); this.gt = parent.getAttribute("goto"); this.play = parent.getAttribute("play"); var tf = parent.getElementsByTagNameNS( SBL.NAMESPACE, "*"); for( var t = tf.item(0); t; t = tf.item(0)) { tname = t.getTagName().replace(/^[^:]+:/, ""); if( tname == 'valMsg') this.getMsg(t); parent.removeChild( t); } }; VKey.prototype.getMsg = function(nLx823) { var er = parseInt( nLx823.getAttribute("err")); if( er == 0) { this.vMsg = nLx823.getAttribute("txt"); this.vIco = nLx823.getAttribute("ico"); this.vCap = nLx823.getAttribute("cap"); } else if( er == 1) { this.erMsg = nLx823.getAttribute("txt"); this.erIco = nLx823.getAttribute("ico"); this.erCap = nLx823.getAttribute("cap"); } }; var g_ValTimeOut = null; function ValTimeOut( ntime, Val) { var nLen; if(g_ValTimeOut == null) g_ValTimeOut = new Array(); nLen = g_ValTimeOut.length; g_ValTimeOut[nLen] = Val; setTimeout( "OnValTimeOut("+nLen+")", ntime*1000); } function OnValTimeOut( n) { if(n<g_ValTimeOut.length && g_ValTimeOut[n].timeVal != null ) { g_ValTimeOut[n].vakey = g_ValTimeOut[n].timeVal; if(g_ValTimeOut[n].timeVal.vMsg) showMsg( g_ValTimeOut[n].timeVal.vIco, g_ValTimeOut[n].timeVal.vCap, g_ValTimeOut[n].timeVal.vMsg, g_ValTimeOut[n], 1); else if(g_ValTimeOut[n].timeVal.vImg) showImg(g_ValTimeOut[n].timeVal.vImg, g_ValTimeOut[n], 1); else g_ValTimeOut[n].OnValidation(1); } } function Chart( nLx823, parent) { if( nLx823 && parent) { this.id = nLx823.getAttribute( "id"); this.x = parseFloat( nLx823.getAttribute( "x")); this.y = parseFloat( nLx823.getAttribute( "y")); this.wd = parseFloat( nLx823.getAttribute( "width")); this.ht = parseFloat( nLx823.getAttribute( "height")); this.fill = nLx823.getAttribute( "fill"); this.fop = nLx823.getAttribute( "fill-opacity"); this.stroke = nLx823.getAttribute( "stroke"); this.sop = nLx823.getAttribute( "stroke-opacity"); this.type = nLx823.getAttribute( "type"); this.title = nLx823.getAttribute( "title"); this.legend = parseInt( nLx823.getAttribute( "legend")); this.tns = nLx823.getAttribute( "transform"); this.cat = null; this.series = null; if(nLx823.hasChildNodes()) this.ParseData(nLx823); if( this.cat && this.series) { var tns = this.tns + " translate("+this.x+","+this.y+")"; this.node = createOnly("g", parent, { "id": this.id, "transform": tns}); parent.insertBefore( this.node, nLx823); this.DrawChart(); } } }; Chart.prototype.ParseData = function( nLx823) { var tf = nLx823.getElementsByTagNameNS( SBL.NAMESPACE, "*"); for( var t = tf.item(0); t; t = tf.item(0)) { var tname = t.getTagName().replace(/^[^:]+:/, ""); if( tname == 'category' && !this.cat ) { var tmp = t.getAttribute("names"); this.cat = new Array(); this.cat = tmp.split(";"); } else if( tname == 'series' ) { if(!this.series) this.series = new Array(); this.series[this.series.length] = new Series(t); } nLx823.removeChild( t); } }; Chart.prototype.GetLargestCategory = function() { var jBo123 = 0; for( var i=0; i<this.cat.length; i++) { var dJv910 = 0; for(var j=0; j<this.series.length; j++) { var tmp = this.series[j]; dJv910 += tmp.values[i]; } if(dJv910 > jBo123) jBo123 = dJv910; } return jBo123; }; Chart.prototype.GetCategorySum = function(hJr478) { var dJv910 = 0; for(var j=0; j<this.series.length; j++) { var tmp = this.series[j]; dJv910 += tmp.values[hJr478]; } return dJv910; }; Chart.prototype.DrawChart = function() { createNode("rect", this.node, { "height": this.ht, "width": this.wd, "fill": this.fill, "fill-opacity": this.fop}); var fTitle = 0.12; var fLegend = 0.20; var sLt926 = new RectF( 0, 0, this.wd, this.ht); if(this.title != "") { var rctFTitle = new RectF( 0, 0, this.wd, sLt926.Height * fTitle); sLt926.Y += rctFTitle.Height; sLt926.Height -= rctFTitle.Height; rctFTitle.Height *= 3/4; this.DrawText( rctFTitle, 110, this.title, 1000, 110); } if( this.legend ) { var pNf135 = sLt926.Width * 0.02; var tEk288 = sLt926.Height * 0.02; var fLWd = sLt926.Width * fLegend; var rctFLegend = new RectF( sLt926.X + sLt926.Width - fLWd + pNf135, sLt926.Y + tEk288, fLWd - 2 * pNf135, sLt926.Height - 2 * tEk288); this.DrawLegend( rctFLegend ); sLt926.Width -= fLWd; } this.DrawPlot( sLt926); }; Chart.prototype.DrawPlot = function(sLt926) { this.CheckMinMax(); switch( this.type) { case '7': this.dOw858 = this.GetLargestCategory(); this.CalculateScale( this.dOw858, 0); break; default: this.dOw858 = 0; this.CalculateScale(this.fMax, this.fMin); break; } var bTitle = (this.title != ""); var yRf685 = this.series.length; var oXo300 = this.cat.length; var nBars = oXo300 * yRf685; var tDe204 = sLt926.Width * 0.1; var fMargBot = sLt926.Height * 0.1; var fMargRight = this.legend?sLt926.Width * 0.01:tDe204; var fMargTop = bTitle?sLt926.Height * 0.01:fMargBot; var fAxisWidth = sLt926.Width - (tDe204 + fMargRight); var fAxisHeight = sLt926.Height - (fMargTop + fMargBot); var fAxisX = sLt926.X + tDe204; var fAxisY = sLt926.Y + fMargTop; var uNt165 = 140.0; switch(this.type) { case '2': { var eFj706 = nBars + oXo300; var jBo123 = fAxisHeight; var iMa515 = 0.0; var fColWd = fAxisWidth / eFj706; var fX = fAxisX + fColWd/2; var fY = fAxisY + fAxisHeight; var rLe753 = new RectF( fAxisX, fY, fColWd * yRf685 + fColWd/2, fMargBot*3/4 ); if(this.fMin != 0) { jBo123 = fAxisHeight * ( this.fMax / ( this.fMax - this.fMin) ); iMa515 = fAxisHeight - jBo123; fY -= iMa515; } { var bRy620 = new RectF( sLt926.X, fY, tDe204, fMargBot *3/4); var nMark = 5; var tPj980Diff = this.tPj980Max / nMark; var fDiff = 0.0; var tPj980 = 0.0; var fVert = fY; var cszScl = ""; if((this.fMax+this.fMin)>0) fDiff = (jBo123 * this.tPj980Max) / this.fMax; else { fDiff = (iMa515 * this.tPj980Min) / this.fMin; tPj980Diff = -this.tPj980Min / nMark; } fDiff /= nMark; bRy620.Y -= fMargBot/2; while(tPj980 <= this.fMax) { cszScl = tPj980; createNode( "line", this.node, { "x1": fAxisX, "y1": fVert, "x2": fAxisX-3, "y2": fVert, "stroke": this.stroke } ); this.DrawText( bRy620, uNt165, cszScl, bRy620.Width * 12, bRy620.Height * 10 ); fVert -= fDiff; tPj980 += tPj980Diff; bRy620.Y -= fDiff; } if(this.fMin != 0) { var bRy620 = new RectF( sLt926.X, fY + fDiff, tDe204, fMargBot*3/4); tPj980 = -tPj980Diff; fVert = fY + fDiff; bRy620.Y -= fMargBot/2; while( this.fMin <= tPj980 ) { cszScl = tPj980; createNode( "line", this.node, { "x1": fAxisX, "y1": fVert, "x2": fAxisX-3, "y2": fVert, "stroke": this.stroke } ); this.DrawText( bRy620, uNt165, ""+tPj980+"", bRy620.Width * 12, bRy620.Height * 10 ); fVert += fDiff; tPj980 -= tPj980Diff; bRy620.Y += fDiff; } } } for( var i=0; i<oXo300; i++) { for( var j=0; j<yRf685; j++) { var psSeries = this.series[j]; var fVal = psSeries.values[i]; var fHt = (fVal/this.fMax) * jBo123; var rctFCh = new RectF( fX, fY - fHt, fColWd, fHt); if( fVal < 0) { rctFCh.Height = fHt = (fVal/this.fMin) * iMa515; rctFCh.Y = fY; } createNode( "rect", this.node, { "x": rctFCh.X, "y": rctFCh.Y, "width": rctFCh.Width, "height": rctFCh.Height, "fill": psSeries.col} ); fX += fColWd; } this.DrawText( rLe753, uNt165, this.cat[i], rLe753.Width * 12, rLe753.Height * 10 ); fX += fColWd; rLe753.X = fX - fColWd/2; } } break; case '1': { var eFj706 = nBars + oXo300; var jBo123 = fAxisWidth; var iMa515 = 0.0; var fColHt = fAxisHeight / eFj706; var fX = fAxisX; var fY = fAxisY + fAxisHeight - fColHt/2; var fMarWd = fColHt * yRf685 + fColHt/2; var rLe753 = new RectF( fX, fY - fMarWd, fMarWd, tDe204*3/4 ); if(this.fMin != 0) { jBo123 = fAxisWidth * ( this.fMax / ( this.fMax - this.fMin) ); iMa515 = fAxisWidth - jBo123; fX += iMa515; } { var bRy620 = new RectF( fX, fAxisY + fAxisHeight, tDe204, fMargBot*3/4); var nMark = 5; var tPj980Diff = this.tPj980Max / nMark; var fDiff = 0.0; var tPj980 = 0.0; var fVert = fX; var cszScl = ""; if((this.fMax+this.fMin)>0) fDiff = (jBo123 * this.tPj980Max) / this.fMax; else { fDiff = (iMa515 * this.tPj980Min) / this.fMin; tPj980Diff = -this.tPj980Min / nMark; } fDiff /= nMark; bRy620.X -= tDe204/2; while(tPj980 <= this.fMax) { cszScl = tPj980; createNode( "line", this.node, { "x1": fVert, "y1": bRy620.Y, "x2": fVert, "y2": bRy620.Y+3, "stroke": this.stroke } ); this.DrawText( bRy620, uNt165, cszScl, bRy620.Width * 12, bRy620.Height * 10 ); fVert += fDiff; tPj980 += tPj980Diff; bRy620.X += fDiff; } if(this.fMin != 0) { bRy620 = new RectF( fX, fAxisY + fAxisHeight, tDe204, fMargBot *3/4); tPj980 = -tPj980Diff; fVert = fX - fDiff; bRy620.X -= fDiff + tDe204/2; while( this.fMin <= tPj980 ) { cszScl = tPj980; createNode( "line", this.node, { "x1": fVert, "y1": bRy620.Y, "x2": fVert, "y2": bRy620.Y+3, "stroke": this.stroke } ); this.DrawText( bRy620, uNt165, cszScl, bRy620.Width * 12, bRy620.Height * 10 ); fVert -= fDiff; tPj980 -= tPj980Diff; bRy620.X -= fDiff; } } } for( var i=0; i<oXo300; i++) { for( var j=0; j<yRf685; j++) { var psSeries = this.series[j]; var fVal = psSeries.values[i]; var fWd = (fVal/this.fMax) * jBo123; var rctFCh = new RectF( fX, fY - fColHt, fWd, fColHt); if( fVal < 0) { rctFCh.Width = fWd = (fVal/this.fMin) * iMa515; rctFCh.X = fX - rctFCh.Width; } createNode( "rect", this.node, { "x": rctFCh.X, "y": rctFCh.Y, "width": rctFCh.Width, "height": rctFCh.Height, "fill": psSeries.col} ); fY -= fColHt; } var mtx = "rotate( 90 )"; var txt = this.DrawGText( rLe753, uNt165, this.cat[i], rLe753.Width * 12, rLe753.Height * 10 ); var tns = txt.getAttribute("transform"); if( tns != "") tns = tns + "," + mtx; else tns = mtx; txt.setAttribute( "transform", tns ); fY -= fColHt; rLe753.Y = fY - fMarWd; } } break; case '4': { var eFj706 = oXo300; var jBo123 = fAxisHeight; var iMa515 = 0.0; var fColWd = fAxisWidth/ eFj706; var fMarg = fColWd/2; var fY = fAxisY + fAxisHeight; var rLe753 = new RectF( fAxisX, fY, fColWd, fMargBot * 3/4 ); if(this.fMin != 0) { jBo123 = fAxisHeight * ( this.fMax / ( this.fMax - this.fMin) ); iMa515 = fAxisHeight - jBo123; fY -= iMa515; } { var bRy620 = new RectF( sLt926.X, fY, tDe204, fMargBot * 3/4); var nMark = 5; var tPj980Diff = this.tPj980Max / nMark; var fDiff = 0.0; var tPj980 = 0.0; var fVert = fY; var cszScl = ""; if((this.fMax+this.fMin)>0) fDiff = (jBo123 * this.tPj980Max) / this.fMax; else { fDiff = (iMa515 * this.tPj980Min) / this.fMin; tPj980Diff = -this.tPj980Min / nMark; } fDiff /= nMark; bRy620.Y -= fMargBot/2; while(tPj980 <= this.fMax) { cszScl = tPj980; createNode( "line", this.node, { "x1": fAxisX, "y1": fVert, "x2": fAxisX-3, "y2": fVert, "stroke": this.stroke } ); this.DrawText( bRy620, uNt165, cszScl, bRy620.Width * 12, bRy620.Height * 10 ); fVert -= fDiff; tPj980 += tPj980Diff; bRy620.Y -= fDiff; } if(this.fMin != 0) { bRy620 = RectF( sLt926.X, fY + fDiff, tDe204, fMargBot); tPj980 = -tPj980Diff; fVert = fY + fDiff; bRy620.Y -= fMargBot/2; while( this.fMin <= tPj980 ) { cszScl = tPj980; createNode( "line", this.node, { "x1": fAxisX, "y1": fVert, "x2": fAxisX-3, "y2": fVert, "stroke": this.stroke } ); this.DrawText( pGdip, bRy620, uNt165, cszScl, bRy620.Width * 12, bRy620.Height * 10 ); fVert += fDiff; tPj980 -= tPj980Diff; bRy620.Y += fDiff; } } } for( var i=0; i<yRf685; i++) { var psSeries = this.series[i]; var fX = fAxisX + fMarg; var points = ""; for( var j=0; j<oXo300; j++) { var fVal = psSeries.values[j]; var fHt = 0; if( fVal < 0) { fHt = (fVal/this.fMin) * iMa515; points += fX + "," + (fY + fHt) + " "; } else { fHt = (fVal/this.fMax) * jBo123; points += fX + "," + (fY - fHt) + " "; } if( i == 0) { var fMY = fAxisY + fAxisHeight; createNode( "line", this.node, { "x1": fX, "y1": fMY, "x2": fX, "y2": fMY+3, "stroke": this.stroke } ); this.DrawText( rLe753, uNt165, this.cat[j], rLe753.Width * 12, rLe753.Height * 10 ); rLe753.X += fColWd; } fX += fColWd; } createNode( "polyline", this.node, { "points": points, "stroke": psSeries.col, "fill": "none" } ); } } break; case '6': { var eFj706 = oXo300; var jBo123 = fAxisHeight; var iMa515 = 0.0; var fColWd = fAxisWidth/ eFj706; var fMarg = fColWd/2; var fY = fAxisY + fAxisHeight; var rLe753 = new RectF( fAxisX, fY, fColWd, fMargBot * 3/4 ); if(this.fMin != 0) { jBo123 = fAxisHeight * ( this.fMax / ( this.fMax - this.fMin) ); iMa515 = fAxisHeight - jBo123; fY -= iMa515; } { var bRy620 = new RectF( sLt926.X, fY, tDe204, fMargBot * 3/4); var nMark = 5; var tPj980Diff = this.tPj980Max / nMark; var fDiff = 0.0; var tPj980 = 0.0; var fVert = fY; var cszScl = ""; if((this.fMax+this.fMin)>0) fDiff = (jBo123 * this.tPj980Max) / this.fMax; else { fDiff = (iMa515 * this.tPj980Min) / this.fMin; tPj980Diff = -this.tPj980Min / nMark; } fDiff /= nMark; bRy620.Y -= fMargBot/2; while(tPj980 <= this.fMax) { cszScl = tPj980; createNode( "line", this.node, { "x1": fAxisX, "y1": fVert, "x2": fAxisX-3, "y2": fVert, "stroke": this.stroke } ); this.DrawText( bRy620, uNt165, cszScl, bRy620.Width * 12, bRy620.Height * 10 ); fVert -= fDiff; tPj980 += tPj980Diff; bRy620.Y -= fDiff; } if(this.fMin != 0) { bRy620 = RectF( sLt926.X, fY + fDiff, tDe204, fMargBot); tPj980 = -tPj980Diff; fVert = fY + fDiff; bRy620.Y -= fMargBot/2; while( this.fMin <= tPj980 ) { cszScl = tPj980; createNode( "line", this.node, { "x1": fAxisX, "y1": fVert, "x2": fAxisX-3, "y2": fVert, "stroke": this.stroke } ); this.DrawText( pGdip, bRy620, uNt165, cszScl, bRy620.Width * 12, bRy620.Height * 10 ); fVert += fDiff; tPj980 -= tPj980Diff; bRy620.Y += fDiff; } } } for( var i=0; i<yRf685; i++) { var psSeries = this.series[i]; var fX = fAxisX + fMarg; for( var j=0; j<oXo300; j++) { var fVal = psSeries.values[j]; var fHt = 0; if( fVal < 0) { fHt = (fVal/this.fMin) * iMa515; createNode( "circle", this.node, { "cx": fX, "cy": (fY + fHt), "r": 2, "fill": psSeries.col } ); } else { fHt = (fVal/this.fMax) * jBo123; createNode( "circle", this.node, { "cx": fX, "cy": (fY - fHt), "r": 2, "fill": psSeries.col } ); } if( i == 0) { var fMY = fAxisY + fAxisHeight; createNode( "line", this.node, { "x1": fX, "y1": fMY, "x2": fX, "y2": fMY+3, "stroke": this.stroke } ); this.DrawText( rLe753, uNt165, this.cat[j], rLe753.Width * 12, rLe753.Height * 10 ); rLe753.X += fColWd; } fX += fColWd; } } } break; case '0': { var eFj706 = oXo300; var jBo123 = fAxisHeight; var iMa515 = 0.0; var fColWd = fAxisWidth/ eFj706; var fMarg = fColWd/2; var fY = fAxisY + fAxisHeight; var rLe753 = new RectF( fAxisX, fY, fColWd, fMargBot * 3/4 ); if(this.fMin != 0) { jBo123 = fAxisHeight * ( this.fMax / ( this.fMax - this.fMin) ); iMa515 = fAxisHeight - jBo123; fY -= iMa515; } { var bRy620 = new RectF( sLt926.X, fY, tDe204, fMargBot * 3/4); var nMark = 5; var tPj980Diff = this.tPj980Max / nMark; var fDiff = 0.0; var tPj980 = 0.0; var fVert = fY; var cszScl = ""; if((this.fMax+this.fMin)>0) fDiff = (jBo123 * this.tPj980Max) / this.fMax; else { fDiff = (iMa515 * this.tPj980Min) / this.fMin; tPj980Diff = -this.tPj980Min / nMark; } fDiff /= nMark; bRy620.Y -= fMargBot/2; while(tPj980 <= this.fMax) { cszScl = tPj980; createNode( "line", this.node, { "x1": fAxisX, "y1": fVert, "x2": fAxisX-3, "y2": fVert, "stroke": this.stroke } ); this.DrawText( bRy620, uNt165, cszScl, bRy620.Width * 12, bRy620.Height * 10 ); fVert -= fDiff; tPj980 += tPj980Diff; bRy620.Y -= fDiff; } if(this.fMin != 0) { bRy620 = RectF( sLt926.X, fY + fDiff, tDe204, fMargBot); tPj980 = -tPj980Diff; fVert = fY + fDiff; bRy620.Y -= fMargBot/2; while( this.fMin <= tPj980 ) { cszScl = tPj980; createNode( "line", this.node, { "x1": fAxisX, "y1": fVert, "x2": fAxisX-3, "y2": fVert, "stroke": this.stroke } ); this.DrawText( pGdip, bRy620, uNt165, cszScl, bRy620.Width * 12, bRy620.Height * 10 ); fVert += fDiff; tPj980 -= tPj980Diff; bRy620.Y += fDiff; } } } for( var i=0; i<yRf685; i++) { var psSeries = this.series[i]; var fX = fAxisX + fMarg; var points = fX + "," + fY + " "; for( var j=0; j<oXo300; j++) { var fVal = psSeries.values[j]; var fHt = 0; if( fVal < 0) { fHt = (fVal/this.fMin) * iMa515; points += fX + "," + (fY + fHt) + " "; } else { fHt = (fVal/this.fMax) * jBo123; points += fX + "," + (fY - fHt) + " "; } if( i == 0) { var fMY = fAxisY + fAxisHeight; createNode( "line", this.node, { "x1": fX, "y1": fMY, "x2": fX, "y2": fMY+3, "stroke": this.stroke } ); this.DrawText( rLe753, uNt165, this.cat[j], rLe753.Width * 12, rLe753.Height * 10 ); rLe753.X += fColWd; } fX += fColWd; } points += (fX - fColWd) + "," + fY + " "; createNode( "polyline", this.node, { "points": points, "fill": psSeries.col, "fill-opacity": "0.8" } ); } } break; case '3': { var eFj706 = oXo300; var jBo123 = fAxisHeight; var iMa515 = 0.0; var fColWd = fAxisWidth/ eFj706; var fMarg = fColWd/2; var fY = fAxisY + fAxisHeight; var rLe753 = new RectF( fAxisX, fY, fColWd, fMargBot * 3/4 ); if(this.fMin != 0) { jBo123 = fAxisHeight * ( this.fMax / ( this.fMax - this.fMin) ); iMa515 = fAxisHeight - jBo123; fY -= iMa515; } { var bRy620 = new RectF( sLt926.X, fY, tDe204, fMargBot * 3/4); var nMark = 5; var tPj980Diff = this.tPj980Max / nMark; var fDiff = 0.0; var tPj980 = 0.0; var fVert = fY; var cszScl = ""; if((this.fMax+this.fMin)>0) fDiff = (jBo123 * this.tPj980Max) / this.fMax; else { fDiff = (iMa515 * this.tPj980Min) / this.fMin; tPj980Diff = -this.tPj980Min / nMark; } fDiff /= nMark; bRy620.Y -= fMargBot/2; while(tPj980 <= this.fMax) { cszScl = tPj980; createNode( "line", this.node, { "x1": fAxisX, "y1": fVert, "x2": fAxisX-3, "y2": fVert, "stroke": this.stroke } ); this.DrawText( bRy620, uNt165, cszScl, bRy620.Width * 12, bRy620.Height * 10 ); fVert -= fDiff; tPj980 += tPj980Diff; bRy620.Y -= fDiff; } if(this.fMin != 0) { bRy620 = RectF( sLt926.X, fY + fDiff, tDe204, fMargBot); tPj980 = -tPj980Diff; fVert = fY + fDiff; bRy620.Y -= fMargBot/2; while( this.fMin <= tPj980 ) { cszScl = tPj980; createNode( "line", this.node, { "x1": fAxisX, "y1": fVert, "x2": fAxisX-3, "y2": fVert, "stroke": this.stroke } ); this.DrawText( pGdip, bRy620, uNt165, cszScl, bRy620.Width * 12, bRy620.Height * 10 ); fVert += fDiff; tPj980 -= tPj980Diff; bRy620.Y += fDiff; } } } for( var i=0; i<yRf685; i++) { var psSeries = this.series[i]; var fX = fAxisX + fMarg; var points = "M "; var fPrevY; for( var j=0; j<oXo300; j++) { var fVal = psSeries.values[j]; var fHt = 0; if( fVal < 0) { fHt = (fVal/this.fMin) * iMa515; if(j == 0) points += fX + "," + (fY + fHt) + " "; else points += "C "+ (fX - fMarg) + "," + fPrevY + " "+ (fX - fMarg) + "," + (fY + fHt) + " "+ fX + "," + (fY + fHt) + " "; fPrevY = fY + fHt; } else { fHt = (fVal/this.fMax) * jBo123; if(j == 0) points += fX + "," + (fY - fHt) + " "; else points += "C "+ (fX - fMarg) + "," + fPrevY + " "+ (fX - fMarg) + "," + (fY - fHt) + " "+ fX + "," + (fY - fHt) + " "; fPrevY = fY - fHt; } if( i == 0) { var fMY = fAxisY + fAxisHeight; createNode( "line", this.node, { "x1": fX, "y1": fMY, "x2": fX, "y2": fMY+3, "stroke": this.stroke } ); this.DrawText( rLe753, uNt165, this.cat[j], rLe753.Width * 12, rLe753.Height * 10 ); rLe753.X += fColWd; } fX += fColWd; } createNode( "path", this.node, { "d": points, "stroke": psSeries.col, "fill": "none" } ); } } break; case '5': for( var i=0; i<yRf685; i++) { var psSeries = this.series[i]; createNode( "path", this.node, { "d": psSeries.pie, "stroke": this.stroke, "fill": psSeries.col } ); } break; case '7': { var eFj706 = 2 * oXo300; var jBo123 = fAxisHeight; var fColWd = fAxisWidth / eFj706; var fMarg = fColWd/2; var fY = fAxisY + fAxisHeight; var rLe753 = new RectF( fAxisX, fY, 2*fColWd, fMargBot*3/4); { var bRy620 = new RectF( sLt926.X, fY, tDe204, fMargBot); var nMark = 5; var tPj980Diff = this.tPj980Max / nMark; var fDiff = 0; var tPj980 = 0; var fVert = fY; var cszScl = ""; fDiff = (jBo123 * this.tPj980Max) / this.dOw858; fDiff /= nMark; bRy620.Y -= fMargBot/2; while(tPj980 <= this.dOw858) { cszScl = tPj980; createNode( "line", this.node, { "x1": fAxisX, "y1": fVert, "x2": fAxisX-3, "y2": fVert, "stroke": this.stroke } ); this.DrawText( bRy620, uNt165, cszScl, bRy620.Width * 12, bRy620.Height * 10 ); fVert -= fDiff; tPj980 += tPj980Diff; bRy620.Y -= fDiff; } } var fX = fAxisX + fMarg; for( var i=0; i<oXo300; i++) { var fCatSum = this.GetCategorySum(i); var fCatHt = (jBo123 * fCatSum) / this.dOw858; var fSY = fY; for( var j=0; j<yRf685; j++) { var psSeries = this.series[j]; var fVal = psSeries.values[i]; var fHt = (fVal * fCatHt) / fCatSum; var rctFCh = new RectF( fX, fSY - fHt, fColWd, fHt); createNode( "rect", this.node, { "x": rctFCh.X, "y": rctFCh.Y, "width": rctFCh.Width, "height": rctFCh.Height, "fill": psSeries.col} ); fSY -= fHt; } this.DrawText( rLe753, uNt165, this.cat[i], rLe753.Width * 12, rLe753.Height * 10 ); fX += 2 * fColWd; rLe753.X = fX - fColWd/2; } } break; default: break; } if(this.type != '5') { createNode( "line", this.node, { "x1": fAxisX, "y1": fAxisY, "x2": fAxisX, "y2": fAxisY + fAxisHeight, "stroke": this.stroke } ); createNode( "line", this.node, { "x1": fAxisX, "y1": fAxisY + fAxisHeight, "x2": fAxisX + fAxisWidth, "y2": fAxisY + fAxisHeight, "stroke": this.stroke } ); } }; Chart.prototype.DrawLegend = function(sLt926) { var cfHt = 1000; var fScale = sLt926.Height / cfHt; var cfWd = (sLt926.Width/sLt926.Height) * cfHt; var vb = "0 0 "+ cfWd + " " + cfHt; var clip = createNode( "svg", this.node, { "viewBox": vb, "x": sLt926.X, "y": sLt926.Y, "width": sLt926.Width, "height": sLt926.Height } ); var yRf685 = this.series.length; var pNf135 = cfWd * 0.04; var tEk288 = cfHt * 0.04; var yYp320 = cfWd * 0.15; var fXi684 = cfHt * 0.06; var fX = pNf135; var fY = tEk288; var fTxtWd = cfWd - ( yYp320 + pNf135 ); var yBx960 = new RectF( fX, fY, yYp320, fXi684 ); var rcfText = new RectF( fX + yYp320 + pNf135, fY, fTxtWd, fXi684 ); for( var j = 0; j < yRf685; j++ ) { if( rcfText.Y + fXi684 + tEk288 * 0.2 > cfHt ) break; var psSeries = this.series[j]; createNode( "rect", clip, { "x": yBx960.X, "y": yBx960.Y, "width": yBx960.Width, "height": yBx960.Height, "fill": psSeries.col} ); var title = createNode( "text", clip, { "x": rcfText.X, "y": rcfText.Y + (45),"fill": this.stroke, "font-size": 45 } ); createText( title, psSeries.name ); rcfText.Y += fXi684 + tEk288; yBx960.Y = rcfText.Y; } createNode( "rect", clip, { "width": cfWd, "height": yBx960.Y - fY + tEk288, "fill": "none", "stroke": this.stroke, "stroke-width": 4 } ); }; Chart.prototype.DrawText = function( sLt926, fFont, cszTxt, fScaleX, fScaleY) { var vb = "0 0 "+ fScaleX + " " + fScaleY; var clip = createNode( "svg", this.node, { "viewBox": vb, "x": sLt926.X, "y": sLt926.Y, "width": sLt926.Width, "height": sLt926.Height } ); var title = createNode( "text", clip, { "x": fScaleX/2, "y": fScaleY - fScaleY * 0.1,"fill": this.stroke, "font-size": fFont, "text-anchor": "middle" } ); createText( title, cszTxt ); return clip; }; Chart.prototype.DrawGText = function( sLt926, fFont, cszTxt, fScaleX, fScaleY) { var vb = "translate( "+ sLt926.X + "," + sLt926.Y + ")"; vb += ", scale("+ (sLt926.Width/fScaleX) + "," + (sLt926.Height/fScaleY) + ")"; var clip = createNode( "g", this.node, { "transform": vb } ); var title = createNode( "text", clip, { "x": fScaleX/2, "y": fScaleY - fScaleY * 0.1,"fill": this.stroke, "font-size": fFont, "text-anchor": "middle" } ); createText( title, cszTxt ); return clip; }; Chart.prototype.CheckMinMax = function() { var yRf685 = this.series.length; var oXo300 = this.cat.length; this.fMax = this.fMin = 0.0; for( var i=0; i<yRf685; i++) { var psSeries = this.series[i]; for( var j=0; j<oXo300; j++) { if( this.fMax < psSeries.values[j] ) this.fMax = psSeries.values[j]; if( this.fMin > psSeries.values[j] ) this.fMin = psSeries.values[j]; } } }; Chart.prototype.CalculateScale = function( fMax, fMin) { var tPj980Max = 0; var fMul = 1; this.tPj980Max = 0; this.tPj980Min = 0; while( fMax > 1) { fMax /= 10; fMul *= 10; } while(tPj980Max < fMax) { if(tPj980Max < fMax) tPj980Max += 0.1; }; this.tPj980Max = tPj980Max * fMul; if( fMin != 0) { var tPj980Min = 0; fMul = 1; fMin = -this.fMin; while( fMin > 1) { fMin /= 10; fMul *= 10; } while(tPj980Min < fMin) tPj980Min += 0.1; this.tPj980Min = -tPj980Min * fMul; } }; Chart.prototype.GetLargestCategory = function() { var fMax = 0; var yRf685 = this.series.length; var oXo300 = this.cat.length; for( var j=0; j<oXo300; j++) { var dJv910 = 0; for( var i=0; i<yRf685; i++) { var psSeries = this.series[i]; if( psSeries.values[j] < 0) dJv910 -= psSeries.values[j]; else dJv910 += psSeries.values[j]; } if(dJv910 > fMax) fMax = dJv910; } return fMax; }; function Series(nLx823) { this.name = nLx823.getAttribute( "name"); this.col = nLx823.getAttribute( "fill"); this.values = new Array(); this.pie = ""; this.pie = nLx823.getAttribute( "pie"); this.Shapes = new Array(); var tmp = nLx823.getAttribute("values"); var val = tmp.split(";"); for(var i=0; i<val.length; i++) { this.values[this.values.length] = parseFloat(val[i]); } }; function RectF( x, y, width, height) { this.X = x; this.Y = y; this.Width = width; this.Height = height; }; function toString( mtx) { var str = "matrix(" + mtx.a + "," + mtx.b + ","+ mtx.c + "," + mtx.d + "," + mtx.e + "," + mtx.f + " )"; return str; }