// -------------------------------------------------------------------- // window open/close replacement (Re:- IE* default to open in new TAB function window_open(url, title, props) { //return window.open(url, title, props); return popwindow(url, title, props); //return new popwindow(url, title, props); } var popwindows = []; var popwindows_baseurl = []; function popwindow(url, title, props) { // exists? var baseurl_arr = url.split("?"); var baseurl = baseurl_arr[0] if ( popwindows_baseurl[baseurl] != null ) { var winid = popwindows_baseurl[baseurl] // set new url popwindows[winid].iframe1.src = url; return popwindows[winid].iframe1.contentWindow; } var title_h = 18; var myprops = props.replace(/\,/g,"\;").replace(/\=/g,"\:"); var winid = popwindows.length; //popwin = document.createElement("<DIV style='" + myprops + "'>"); popwin = document.createElement("<DIV" //+ " id='popwin_" + winid + "'" + " style='" + myprops + "'" + ">"); popwindows[winid] = popwin; popwindows_baseurl[baseurl] = winid; popwin.baseurl = baseurl; //popwin.id = "my_" + title; popwin.id = "popwin_" + winid; popwin.style.z_index = 1; //popwin.style.display = "none"; //popwin.style.filter = 'alpha(opacity=0)'; popwin.style.position = "absolute"; popwin.style.border = "4"; popwin.style.borderStyle = "outset"; var frame_h = parseInt(popwin.style.height.replace(/px/,"")); var frame_w = parseInt(popwin.style.width.replace(/px/,"")); popwin.style.height = (title_h + frame_h) + "px"; var outp = ""; outp += "<div style='" + " background: navy;" + " height: " + title_h + ";" + " width: 100%;" + " border: 0;" + "'>"; outp += "<table border=0 width='100%'>"; outp += "<td align=left style='"; outp += " padding-left: 5;" outp += " color: white;"; outp += " font: normal normal bold 9pt Arial;"; outp += "'>"; outp += title; outp += "</td>"; outp += "<td align=right valign=top>"; //outp += " " //outp += " " //outp += " " //outp += " " //outp += "<a href='javascript: window_close(" + popwin.id + ");'" //outp += "<a href='javascript: popwin.close();'" outp += "<a href='javascript: " + popwin.id + ".close();'" + " title='Close this Window.'" + " style='" + " color: #808285;" + " background: #BBBBBB;" + " text-decoration: none;" + " border: 2;" + " border-style: outset;" + " font: normal normal bold 7pt Arial" //+ " float: right;" //+ "'> X " + "'>Close" + "</a>"; //outp += "<input type='BUTTON' title='Close this window.' style='font-size: 7pt' onclick='window_close(this);' value='X'>"; outp += "</td>"; outp += "</tr>"; outp += "</table>"; outp += "</div>"; var frame1name = "frame1"; //outp = "" //outp += "<iframe" ////outp += " id='" + frame1name + "'" + " name='" + frame1name + "'"; //outp += " src='" + url + "'"; ////outp += " src=''"; //outp += " height=" + frame_h; //outp += " width=" + frame_w; ////outp += " width='100%'"; //outp += ">"; //outp += "</iframe>"; popwin.innerHTML = outp; //alert(outp); iframe1 = document.createElement("<IFRAME>"); iframe1.id = frame1name; iframe1.name = frame1name; iframe1.style.height = frame_h + "px"; //iframe1.style.width = frame_w + "px"; iframe1.style.width = "100%"; //iframe1.src = url; iframe1.popwin = popwin; popwin.iframe1 = iframe1; popwin.appendChild(iframe1); document.body.appendChild(popwin); // methods popwin.close = function () { //alert("popwin.close()"); popwin.removeNode(true); popwindows[popwin.winid] = null; popwindows_baseurl[popwin.baseurl] = null; } iframe1.close = function () { //alert("frame1.close()"); iframe1.popwin.close(); } iframe1.attachEvent("onload", function() { //alert("frame1 loaded"); //alert("b iframe1.contentWindow.close = " + iframe1.contentWindow.close); //iframe1.contentWindow.nativeclose = iframe1.contentWindow.closel; iframe1.contentWindow.close = function () { //iframe1.contentWindow.nativeclose(); //alert("frame1.contentWindow.close()"); iframe1.close(); } //alert("a iframe1.contentWindow.close = " + iframe1.contentWindow.close); }); //iframe1.attachEvent("onbeforeunload", function() { // alert("frame1 before unload"); // iframe1.close(); // }); //this.close = this.popwin.close; //this.focus = this.popwin.focus; //this.blur = this.popwin.blur; //this.toggle = function () { this.popwin.style.visibility = this.popwin.style.visibility == 'visible' ? 'hidden' : 'visible'; } //alert("here 0 popwin.id = [" + popwin.id + "]" + " HTML = " + popwin.outerHTML); //alert("iframe1.contentWindow = " + iframe1.contentWindow); ////iframe1.contentWindow.opener = window; // load url iframe1.src = url; //var popwinel = document.getElementById(popwin.id); //alert("here 1 id=" + popwinel.id); //popwinel.frame1.setAttribute('src', url); //frame1.src = url; //alert("here 2"); //popwin.style.visibility = 'hidden'; //alert("here 3"); popwin.style.visibility = 'visible'; //return popwin; //return iframe1; return iframe1.contentWindow; } //function window_close(x) //{ // alert("window_close(" + x + ")"); // if ( typeof(x) == "object" ) // x.removeNode(true); // else // eval(x + ".removeNode(true)"); //}