stray closing /TABLE in the no-ticket case
[freeside.git] / httemplate / elements / iframecontentmws.js
index c809989..f2a91d2 100644 (file)
@@ -1,20 +1,59 @@
 /*\r
- iframecontentmws.js - Foteos Macrides\r
-   Initial: October 10, 2004 - Last Revised: May 9, 2005\r
- Simple script for using an HTML file as iframe content in overlibmws popups.\r
- Include WRAP and TEXTPADDING,0 in the overlib call to ensure that the width\r
- arg is respected (unless the CAPTION plus CLOSETEXT widths add up to more than\r
- the width arg, in which case you should increase the width arg).  The name arg\r
- should be a unique string for each popup with iframe content in the document.\r
- The frameborder arg should be 1 (browser default if omitted) or 0.\r
+ iframecontentmws.js - Foteos Macrides (author and copyright holder)\r
+   Initial: October 10, 2004 - Last Revised: January 26, 2008\r
+ Scripts for using HTML documents as iframe content in overlibmws popups.\r
 \r
- See http://www.macridesweb.com/oltest/IFRAME.html for demonstration.\r
+ See http://www.macridesweb.com/oltest/IFRAME.html\r
+ and http://www.macridesweb.com/oltest/AJAX.html#ajaxex3\r
+ for more information.\r
 */\r
 \r
-function OLiframeContent(src, width, height, name, frameborder) {\r
+/*\r
+ Use as lead argument in overlib or overlb2 calls.  Include WRAP and\r
+ TEXTPADDING,0 in the call to ensure that the width arg is respected (unless\r
+ the CAPTION plus CLOSETEXT widths add up to more than the width arg, in which\r
+ case you should increase the width arg).  The name arg should be a unique\r
+ string for each popup with iframe content in the document.  The frameborder\r
+ arg should be 1 (browser default if omitted) or 0.  The scrolling arg should\r
+ be 'auto' (default if omitted), 'yes' or 'no'.\r
+*/\r
+function OLiframeContent(src, width, height, name, frameborder, scrolling) {\r
\r
+ /* stupid safari iframe location caching... */\r
+ var d = new Date();\r
+ var unique = d.getTime() + '' + Math.floor(1000 * Math.random());\r
+ name = name + '' + unique;\r
+\r
  return ('<iframe src="'+src+'" width="'+width+'" height="'+height+'"'\r
  +(name!=null?' name="'+name+'" id="'+name+'"':'')\r
  +(frameborder!=null?' frameborder="'+frameborder+'"':'')\r
- +' scrolling="auto">'\r
- +'<div>[iframe not supported]</div></iframe>');\r
+ +' scrolling="'+(scrolling!=null?scrolling:'auto')\r
+ +'"><div>[iframe not supported]</div></iframe>');\r
+}\r
+\r
+/*\r
+ Swap the src if we are iframe content.  The name arg should be the same\r
+ string as in the OLiframeContent function for the popup.  The src arg is\r
+ a partial, relative, or complete URL for the document to be swapped in.\r
+*/\r
+function OLswapIframeSrc(name, src){\r
+ if(parent==self){\r
+  alert(src+'\n\n is only for iframe content');\r
+  return;\r
+ }\r
+ var o=parent.OLgetRef(name);\r
+ if(o)o.src=src;\r
+ else alert(src+'\n\n is not available');\r
+}\r
+\r
+/*\r
+ Emulate the Back button if we are iframe content.  Use only in documents\r
+ which are swapped in by using the OLswapIframeSrc function.\r
+*/\r
+function OLiframeBack(){\r
+ if(parent==self){\r
+  alert('This feature is only for iframe content');\r
+  return;\r
+ }\r
+ history.back();\r
 }\r