home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2004 March / PCWMAR04.iso / Sponsors / Xara / webstyle / pz_chromeless_2.1.js < prev    next >
Encoding:
JavaScript  |  2003-12-18  |  36.6 KB  |  311 lines

  1. // chromeless windows v2.1
  2. // www.microbians.com / Gabriel Suchowolski power[z]one - powerz@microbians.com
  3. //
  4. // Distributed under the terms of the GNU Library General Public License
  5. //
  6. // - Chromeless trick by webFX. http://www.eae.net/webfx/
  7. // - Chromeless mouse control to handled like a normal window by Gabriel Suchowolski power[z]one
  8.  
  9. function openchromeless(theURL, wname, W, H, posx, posy, windowTIT, windowREALtit ,
  10.                                         windowBORDERCOLOR, windowBORDERCOLORsel, windowTITBGCOLOR, windowTITBGCOLORsel,
  11.                                             bCenter, sFontFamily, sFontSize, sFontColor) {
  12.     
  13.     var windowCERRARa = "close_a.gif";
  14.     var windowCERRARd = "close_d.gif";
  15.     var windowCERRARo = "close_o.gif";
  16.     var windowNONEgrf = "none.gif";
  17.     var windowCLOCK = "clock.gif";
  18.     var windowW = W;
  19.     var windowH = H;
  20.     var windowX = -1;
  21.     var windowY = -1;
  22.     
  23.     if(bCenter){    
  24.         windowX = Math.ceil( (window.screen.width  - windowW) / 2 );
  25.         windowY = Math.ceil( (window.screen.height - windowH) / 2 );
  26.     } else {
  27.         windowX = posx;
  28.         windowY = posy;
  29.     }
  30.  
  31.     if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion)>=4) isie=true
  32.     else                                                 isie=false
  33.  
  34.     if (isie) { H=H+20+2; W=W+2; }
  35.  
  36.     s = ",width="+W+",height="+H;
  37.  
  38.     if (isie && (navigator.userAgent.toLowerCase().indexOf("win")!=-1) ) {
  39.  
  40. var dowin = theURL != "" ? true : false;
  41.  
  42. var chromeTIThtml = '\n' +
  43. '<html>                                                                                            '+ '\n'+
  44. '<HEAD><meta http-equiv="Pragma" content="no-cache">'+ '\n'+
  45. '<title> CHROMELESS WINDOWS / TITLEBAR</title>                                                                                                                              '+ '\n'+
  46. '<style type="text/css">                                                                                                                                                            '+ '\n'+
  47. '#mywindowTITLE     { position: absolute; left:   0px; top:   0px; width: 100%; height: 22px; z-index: 1; background-color: '+windowTITBGCOLOR+'; clip:rect(0,100%,22,0); }         '+ '\n'+
  48. '#mywindow         { position: absolute; left:   0px; top:   0px; width: 100%; height: 22px; z-index: 2;                                      clip:rect(0,100%;22,0); }         '+ '\n'+
  49. '#mywindowCLOSE     { position: absolute; left: -22px; top: -22px; width: 11px; height: 11px; z-index: 3;                                      clip:rect(0,11,11,0);   }         '+ '\n'+
  50. '#mywindowCLOCK     { position: absolute; left: -22px; top: -22px; width: 11px; height: 11px; z-index: 3;                                      clip:rect(0,11,11,0);   }         '+ '\n'+
  51. '</style>                                                                                                                                                                           '+ '\n'+
  52. '<script language="javascript">                                                                                '+ '\n'
  53.  
  54. if ( theURL != "" ) {
  55.  
  56. chromeTIThtml = chromeTIThtml + 
  57. '    theURL                 = "'+theURL            +'"                                                                                                                             '+ '\n'+
  58. '    windowCERRARa         = "'+windowCERRARa        +'"                                                                                                                             '+ '\n'+
  59. '    windowCERRARd         = "'+windowCERRARd        +'"                                                                                                                             '+ '\n'+
  60. '    windowCERRARo         = "'+windowCERRARo        +'"                                                                                                                             '+ '\n'+
  61. '    windowCLOCK         = "'+windowCLOCK            +'"                                                                                                                             '+ '\n'+
  62. '    windowBORDERCOLOR   = "'+windowBORDERCOLOR    +'"                                                                                                                             '+ '\n'+
  63. '    windowBORDERCOLORsel= "'+windowBORDERCOLORsel    +'"                                                                                                                             '+ '\n'+
  64. '    windowTITBGCOLOR    = "'+windowTITBGCOLOR    +'"                                                                                                                             '+ '\n'+
  65. '    windowTITBGCOLORsel = "'+windowTITBGCOLORsel    +'"                                                                                                                             '+ '\n'
  66.  
  67. } else {
  68.  
  69. chromeTIThtml = chromeTIThtml + 
  70. '    theURL="about:blank"                                                                                                                                                            '+ '\n'+
  71. '    windowCERRARa         = "img/close_a.gif"                                                                                                                                     '+ '\n'+
  72. '    windowCERRARd         = "img/close_d.gif"                                                                                                                                     '+ '\n'+
  73. '    windowCERRARo         = "img/close_o.gif"                                                                                                                                     '+ '\n'+
  74. '    windowCLOCK             = "img/clock.gif"                                                                                                                                     '+ '\n'+
  75. '    windowTIT             = "<font face=verdana size=1>  window title</font>"                                                                                               '+ '\n'+
  76. '    windowBORDERCOLOR       = "#000000"                                                                                                                                             '+ '\n'+
  77. '    windowBORDERCOLORsel    = "#FF8A00"                                                                                                                                             '+ '\n'+
  78. '    windowTITBGCOLOR        = "#d7dcd9"                                                                                                                                             '+ '\n'+
  79. '    windowTITBGCOLORsel     = "#ffffff"                                                                                                                                             '+ '\n'
  80.  
  81. }
  82.  
  83. chromeTIThtml = chromeTIThtml + 
  84. 'var windowCERRARImg_a = new Image(); windowCERRARImg_a.src = windowCERRARa;                                                                                                            '+ '\n'+
  85. 'var windowCERRARImg_d = new Image(); windowCERRARImg_d.src = windowCERRARd;                                                                                                            '+ '\n'+
  86. 'var windowCERRARImg_o = new Image(); windowCERRARImg_o.src = windowCERRARo;                                                                                                            '+ '\n'+
  87. 'var windowCLOCKImg    = new Image();    windowCLOCKImg.src = windowCLOCK;                                                                                                              '+ '\n'+
  88. '                                                                                                                                                                                       '+ '\n'+
  89. 'function mouseSTATUS() {                                                                                                                                                               '+ '\n'+
  90. '    this.x       = null;                                                                                                                                                            '+ '\n'+
  91. '    this.y       = null;                                                                                                                                                            '+ '\n'+
  92. '    this.bt      = "up";                                                                                                                                                            '+ '\n'+
  93. '    this.oldx    = null;                                                                                                                                                            '+ '\n'+
  94. '    this.oldy    = null;                                                                                                                                                            '+ '\n'+
  95. '    this.dx      = null;                                                                                                                                                            '+ '\n'+
  96. '    this.dy      = null;                                                                                                                                                            '+ '\n'+
  97. '    this.screeny = null;                                                                                                                                                            '+ '\n'+
  98. '    this.screenx = null;                                                                                                                                                            '+ '\n'+
  99. '                                                                                                                                                                                       '+ '\n'+
  100. '    this.element = null;                                                                                                                                                            '+ '\n'+
  101. '    this.event   = null;                                                                                                                                                            '+ '\n'+
  102. '}                                                                                                                                                                                      '+ '\n'+
  103. '                                                                                                                                                                                       '+ '\n'+
  104. 'var mouse = new mouseSTATUS();                                                                                                                                                         '+ '\n'+
  105. '                                                                                                                                                                                       '+ '\n'+
  106. 'function actualizateMouseSTATUS(e) {                                                                                                                                                   '+ '\n'+
  107. '    if (!e) var e = event                                                                                                                                                           '+ '\n'+
  108. '    if ( (e.type=="mousedown" || e.type=="mouseup") && e.button!=1) return true                                                                                                     '+ '\n'+
  109. '                                                                                                                                                                                       '+ '\n'+
  110. '    var x=e.x+document.body.scrollLeft                                                                                                                                              '+ '\n'+
  111. '    var y=e.y+document.body.scrollTop                                                                                                                                               '+ '\n'+
  112. '                                                                                                                                                                                       '+ '\n'+
  113. '    mouse.x   = x;                                                                                                                                                                  '+ '\n'+
  114. '    mouse.y   = y;                                                                                                                                                                  '+ '\n'+
  115. '                                                                                                                                                                                       '+ '\n'+
  116. '         if ( e.type == "mousedown" ) mouse.bt = "down";                                                                                                                            '+ '\n'+
  117. '    else if ( e.type == "mouseup" )   mouse.bt = "up";                                                                                                                              '+ '\n'+
  118. '                                                                                                                                                                                       '+ '\n'+
  119. '    if (window.event) {                                                                                                                                                             '+ '\n'+
  120. '        mouse.screenx=window.event.screenX;                                                                                                                                     '+ '\n'+
  121. '        mouse.screeny=window.event.screenY;                                                                                                                                     '+ '\n'+
  122. '    } else {                                                                                                                                                                        '+ '\n'+
  123. '        mouse.screenx=-1;                                                                                                                                                       '+ '\n'+
  124. '        mouse.screeny=-1;                                                                                                                                                       '+ '\n'+
  125. '    }                                                                                                                                                                               '+ '\n'+
  126. '                                                                                                                                                                                       '+ '\n'+
  127. '}                                                                                                                                                                                      '+ '\n'+
  128. '                                                                                                                                                                                       '+ '\n'+
  129. '                                                                                                                                                                                       '+ '\n'+
  130. 'function initMouseEvents() {                                                                                                                                                           '+ '\n'+
  131. '    document.onmousedown = actualizateMouseSTATUS                                                                                                                                   '+ '\n'+
  132. '    document.onmousemove = actualizateMouseSTATUS                                                                                                                                   '+ '\n'+
  133. '    document.onmouseup   = actualizateMouseSTATUS                                                                                                                                   '+ '\n'+
  134. '    document.onselectstart = selectstart                                                                                                                                            '+ '\n'+
  135. '    document.ondragstart   = new Function("actualizateMouseSTATUS(event); return false;")                                                                                           '+ '\n'+
  136. '}                                                                                                                                                                                      '+ '\n'+
  137. '                                                                                                                                                                                       '+ '\n'+
  138. 'function selectstart(){                                                                                                                                                                '+ '\n'+
  139. '    if ( event.srcElement.tagName != "INPUT" && event.srcElement.tagName != "TEXTAREA") { return false; }                                                                           '+ '\n'+
  140. '    else { mouse.bt="up"; return true; }                                                                                                                                            '+ '\n'+
  141. '}                                                                                                                                                                                      '+ '\n'+
  142. '                                                                                            '+ '\n'+
  143. 'initMouseEvents()                                                                                                                                                                      '+ '\n'+
  144. '                                                                                            '+ '\n'+
  145. 'var mywindowbt    ="up";                                                                                                                                                               '+ '\n'+
  146. 'var wincloseSTATUS="up";                                                                                                                                                               '+ '\n'+
  147. '                                                                                            '+ '\n'+
  148. 'var ofx=0;                                                                                                                                                                             '+ '\n'+
  149. 'var ofy=0;                                                                                                                                                                             '+ '\n'+
  150. 'var opx=0;                                                                                                                                                                             '+ '\n'+
  151. 'var opy=0;                                                                                                                                                                             '+ '\n'+
  152. 'var px=0;                                                                                                                                                                              '+ '\n'+
  153. 'var py=0;                                                                                                                                                                              '+ '\n'+
  154. '                                                                                            '+ '\n'+
  155. 'var wcpx1=-1, wcpy1=-1;                                                                                                                                                                '+ '\n'+
  156. 'var wcpx2=-1, wcpy2=-1;                                                                                                                                                                '+ '\n'+
  157. '                                                                                            '+ '\n'+
  158. 'var wclosechanged = false;                                                                                                                                                             '+ '\n'+
  159. '                                                                                            '+ '\n'+
  160. 'function initToMoveWin() {                                                                                                                                                             '+ '\n'+
  161. '        if (wincloseSTATUS=="up" && ( mywindowbt=="up" || mywindowbt=="over") ) {                                                                                               '+ '\n'+
  162. '                                                                                                                     '+ '\n'+
  163. '                if ( parent.mainloaded ) document.all["mywindowCLOCK"].style.visibility = "hidden";                                                             '+ '\n'+
  164. '                                                                                                                     '+ '\n'+
  165. '                document.all["mywindowCLOCK"].style.pixelLeft=document.body.clientWidth-36                                         '+ '\n'+
  166. '                document.all["mywindowCLOCK"].style.pixelTop =4                                                                                         '+ '\n'+
  167. '                                                                                                                     '+ '\n'+
  168. '                wcpx1 = document.all["mywindowCLOSE"].style.pixelLeft=document.body.clientWidth-18                                                                      '+ '\n'+
  169. '                wcpy1 = document.all["mywindowCLOSE"].style.pixelTop =4                                                                                                 '+ '\n'+
  170. '                wcpx2 = wcpx1 + 11 - 1                                                                                                                                  '+ '\n'+
  171. '                wcpy2 = wcpy1 + 11 - 1                                                                                                                                  '+ '\n'+
  172. '                if ( mouse.x >= wcpx1 && mouse.x <= wcpx2 && mouse.y >= wcpy1 && mouse.y <= wcpy2) {                                                                    '+ '\n'+
  173. '                    if (wclosechanged == false) {                                                                                                                   '+ '\n'+
  174. '                        document.all["mywindowCLOSE"].document.images["closewin"].src=windowCERRARImg_o.src                                                     '+ '\n'+
  175. '                        wclosechanged = true                                                                                                                    '+ '\n'+
  176. '                    }                                                                                                                                               '+ '\n'+
  177. '                                                                                                                                                                '+ '\n'+
  178. '                } else if (wclosechanged == true) {                                                                                                                     '+ '\n'+
  179. '                    document.all["mywindowCLOSE"].document.images["closewin"].src=windowCERRARImg_d.src                                                             '+ '\n'+
  180. '                    wclosechanged = false                                                                                                                           '+ '\n'+
  181. '                }                                                                                                                                                       '+ '\n'+
  182. '        }                                                                                                                                                                       '+ '\n'+
  183. '                                                                                            '+ '\n'+
  184. '             if (   mouse.y <= 22 && mouse.y >= 1   && mywindowbt == "up"   && mouse.bt =="up"    ) { mywindowbt = "over" }                                                     '+ '\n'+
  185. '        else if ( ( mouse.y  > 22 || mouse.y <  1 ) && mywindowbt == "over" && mouse.bt =="up"    ) { mywindowbt = "up"   }                                                     '+ '\n'+
  186. '        else if (   mouse.y <= 22 && mouse.y >= 1   && mywindowbt == "over" && mouse.bt == "down" ) {                                                                           '+ '\n'+
  187. '            self.window.focus();                                                                                                                                            '+ '\n'+
  188. '                                                                                                                                                                                    '+ '\n'+
  189. '            if ( mouse.x >= wcpx1 && mouse.x <= wcpx2 && mouse.y >= wcpy1 && mouse.y <= wcpy2 ) {                                                                           '+ '\n'+
  190. '                wincloseSTATUS="down"                                                                                                                                   '+ '\n'+
  191. '                document.all["mywindowCLOSE"].document.images["closewin"].src=windowCERRARImg_a.src                                                                     '+ '\n'+
  192. '            } else {                                                                                                                                                        '+ '\n'+
  193. '                document.all["mywindowTITLE"].style.backgroundColor = windowTITBGCOLORsel                                                                               '+ '\n'+
  194. '                document.body.style.borderColor    = windowBORDERCOLORsel                                                                                               '+ '\n'+
  195. '                parent.chromewinb.document.bgColor = windowBORDERCOLORsel                                                                                               '+ '\n'+
  196. '                parent.chromewinl.document.bgColor = windowBORDERCOLORsel                                                                                               '+ '\n'+
  197. '                parent.chromewinr.document.bgColor = windowBORDERCOLORsel                                                                                               '+ '\n'+
  198. '                ofx =  mouse.x;                                                                                                                                         '+ '\n'+
  199. '                ofy =  mouse.y;                                                                                                                                         '+ '\n'+
  200. '                opx =  mouse.x;                                                                                                                                         '+ '\n'+
  201. '                opy =  mouse.y;                                                                                                                                         '+ '\n'+
  202. '            }                                                                                                                                                            '+ '\n'+
  203. '            mywindowbt="down";                                                                                                                                              '+ '\n'+
  204. '        }                                                                                                                                                                       '+ '\n'+
  205. '        else if ( mouse.bt =="up" && mywindowbt == "down" ) {                                                                                                                   '+ '\n'+
  206. '            mywindowbt="up";                                                                                                                                                '+ '\n'+
  207. '            ofx=0;                                                                                                                                                          '+ '\n'+
  208. '            ofy=0;                                                                                                                                                          '+ '\n'+
  209. '            opx=0;                                                                                                                                                          '+ '\n'+
  210. '            opy=0;                                                                                                                                                          '+ '\n'+
  211. '                                                                                            '+ '\n'+
  212. '            if ( mouse.x >= wcpx1 && mouse.x <= wcpx2 && mouse.y >= wcpy1 && mouse.y <= wcpy2 && wincloseSTATUS=="down" ) { top.window.close() }                            '+ '\n'+
  213. '                                                                                            '+ '\n'+
  214. '            wincloseSTATUS="up"                                                                                                                                             '+ '\n'+
  215. '                                                                                                                                                                                '+ '\n'+
  216. '            if ( document.all["mywindowTITLE"] ) {                                                                                                                          '+ '\n'+
  217. '                document.all["mywindowTITLE"].style.backgroundColor = windowTITBGCOLOR                                                                                  '+ '\n'+
  218. '                document.body.style.borderColor   = windowBORDERCOLOR                                                                                                   '+ '\n'+
  219. '                parent.chromewinb.document.bgColor= windowBORDERCOLOR                                                                                                   '+ '\n'+
  220. '                parent.chromewinl.document.bgColor= windowBORDERCOLOR                                                                                                   '+ '\n'+
  221. '                parent.chromewinr.document.bgColor= windowBORDERCOLOR                                                                                                   '+ '\n'+
  222. '            }                                                                                                                                                               '+ '\n'+
  223. '                                                                                            '+ '\n'+
  224. '        }                                                                                                                                                                       '+ '\n'+
  225. '        else if ( mywindowbt == "down" && wincloseSTATUS == "up") {                                                                                                             '+ '\n'+
  226. '            var m_scrx = mouse.screenx;                                                                                                                                     '+ '\n'+
  227. '            var m_scry = mouse.screeny;                                                                                                                                     '+ '\n'+
  228. '            opx = px + ofx - m_scrx;                                                                                                                                        '+ '\n'+
  229. '            opy = py + ofy - m_scry;                                                                                                                                        '+ '\n'+
  230. '            px = m_scrx - ofx;                                                                                                                                              '+ '\n'+
  231. '            py = m_scry - ofy;                                                                                                                                              '+ '\n'+
  232. '            top.window.moveTo(px , py);                                                                                                                                     '+ '\n'+
  233. '        }                                                                                                                                                                       '+ '\n'+
  234. '    setTimeout("initToMoveWin()",50);                                                                                                                                               '+ '\n'+
  235. '}                                                                                                                                                                                      '+ '\n'+
  236. '</script>                                                                                                                                '+ '\n'+
  237. '</head>                                                                                                                                                                            '+ '\n'+
  238. '<body TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=no style="border: 1px solid '+ windowBORDERCOLOR +'; overflow: hidden; margin: 0pt;" bgcolor='+windowTITBGCOLOR+'>  '+ '\n'+
  239. '<div id=mywindow><img src="'+windowNONEgrf+'" width=100% height=20></div>                                                                                                                 '+ '\n'+
  240. '<div id=mywindowTITLE>'+ '<table width=100% height=20 border=0 cellpadding=0 cellspacing=0><tr><td valign=middle align=left><font face="' + sFontFamily + '" size=' + sFontSize + ' color="' + sFontColor + '">    ' + windowTIT + '</font></td></tr></table>' +'</div>                  '+ '\n'+
  241. '<div id=mywindowCLOSE><img name=closewin src="'+ windowCERRARd +'" border=0 width=11 height=11></div>                                                                                  '+ '\n'+
  242. '<div id=mywindowCLOCK><img name=clockwin src="'+ windowCLOCK   +'" border=0 width=11 height=11></div>                                                                                  '+ '\n'+
  243. '</body>                                                                                                                                                                            '+ '\n'+
  244. '<script>initToMoveWin();</script>                                                                            '+ '\n'+
  245. '</html>                                                                                                                                                                            '+ '\n'
  246.  
  247. var chromeFRMhtml = '' +
  248. '<HTML>                                                                        '+ '\n'+
  249. '<HEAD><meta http-equiv="Pragma" content="no-cache">'+ '\n'+
  250. '<TITLE>' + '  ' + windowREALtit + '</TITLE>                                                                              '+ '\n'+
  251. '</HEAD>                                                                                                        '+ '\n'+
  252. '<script>                                                                     '+ '\n'+
  253. 'mainloaded = false                                                                '+ '\n'+
  254. 'function generatetitle() {                                                             '+ '\n'+
  255. '    if( window.frames["chromewint"] && window.frames["chromewinl"] && window.frames["chromewinb"] && window.frames["chromewinr"] ) {    '+ '\n'+
  256. '        chromewint.document.open();                                                    '+ '\n'+
  257. '        chromewint.document.write( "'+ quitasaltolinea(chromeTIThtml) +'" );                                '+ '\n'+
  258. '        chromewint.document.close();                                                    '+ '\n'+
  259. '        chromewinl.document.bgColor="'+ windowBORDERCOLOR +'"                                        '+ '\n'+
  260. '        chromewinb.document.bgColor="'+ windowBORDERCOLOR +'"                                        '+ '\n'+
  261. '        chromewinr.document.bgColor="'+ windowBORDERCOLOR +'"                                        '+ '\n'+
  262. '    } else {                                                                '+ '\n'+
  263. '        setTimeout("generatetitle()",200)                                                '+ '\n'+
  264. '    }                                                                    '+ '\n'+
  265. '}                                                                        '+ '\n'+
  266. 'generatetitle()                                                                '+ '\n'+
  267. '</script>                                                                    '+ '\n'+
  268. '<frameset border=0 framespacing=0 frameborder=0 rows="22,100%,1" onload="mainloaded=true" onreadystatechange="generatetitle()">        '+ '\n'+
  269. '    <frame name=chromewint src="about:blank" scrolling=no noresize>                                      '+ '\n'+
  270. '    <frameset border=0 framespacing=0 frameborder=0 cols="1,100%,1">                                        '+ '\n'+
  271. '        <frame name=chromewinl src="about:blank" scrolling=no noresize>                                 '+ '\n'+
  272. '        <frame name=main       src="'+theURL+'">                                                       '+ '\n'+
  273. '        <frame name=chromewinr src="about:blank" scrolling=no noresize>                                 '+ '\n'+
  274. '    </frameset>                                                                                             '+ '\n'+
  275. '    <frame name=chromewinb src="about:blank" scrolling=no noresize>                                         '+ '\n'+
  276. '</frameset>                                                                                                    '+ '\n'+
  277. '</HTML>                                                                                                        '
  278.  
  279.         splashWin = window.open( "" , wname, "fullscreen=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0"+s);
  280.  
  281.         splashWin.resizeTo( Math.ceil( W )       , Math.ceil( H ) );
  282.         splashWin.moveTo  ( Math.ceil( windowX ) , Math.ceil( windowY ) );
  283.  
  284.         splashWin.document.open();
  285.         splashWin.document.write( chromeFRMhtml );
  286.         splashWin.document.close();
  287.  
  288.     }
  289.     else    {
  290.         var splashWin = window.open(theURL, wname, "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1"+s, true);
  291.     }
  292.  
  293.     splashWin.focus();
  294. }                                                                               
  295.                                                                                 
  296. function quitasaltolinea(txt) {
  297.  
  298.   var salida = txt.toString()
  299.   var re     = /\\/g; var salida = salida.replace(re, "\\\\");
  300.   var re     = /\//g; var salida = salida.replace(re, "\\\/");
  301.   var re     = /\"/g; var salida = salida.replace(re, "\\\"");
  302.   var re     = /\'/g; var salida = salida.replace(re, "\\\'");
  303.   var re     = /\n/g; var salida = salida.replace(re, "\\n");
  304.   var re     = /  /g; var salida = salida.replace(re, "");
  305.   var re     = /\t/g; var salida = salida.replace(re, "");
  306.   var re     = /\r/g; var salida = salida.replace(re, "");
  307.  
  308.   return salida
  309.  
  310. }
  311.