window.addEventListener("load", function() { var floating_window_parent = false; var obj_parent_pos = false; var auto_reset_content_when_closed = false; var extra_winid = ""; extraheight = 75; function register_floating_window(winid) { extra_winid = winid; } window.register_floating_window = register_floating_window; function open_floating_window(set_title,set_content,set_parent,setwidth,setheight,framename,setcolor,call_when_built) { if(!setcolor) setcolor = "#ddddee"; if(!setwidth) setwidth = 480; if(!setheight) setheight = 320; var fwt = ersDE("floating_window_table"); if (fwt) { fwt.style.backgroundColor = setcolor; fwt.style.minHeight = setheight + "px"; } //document.getElementById("floating_window").style.width = setwidth + "px"; //document.getElementById("floating_window").style.height = setheight + "px"; //document.getElementById("floating_window").style.maxWidth = "80vw"; //document.getElementById("floating_window").style.top = "50%"; //document.getElementById("floating_window").style.left = "50%"; var winWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var winHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; //if(winWidth > setwidth) document.getElementById("floating_window").style.marginLeft = -1 * (winWidth / 2) + "px"; if((setheight + extraheight) * 1 >= winHeight * 1) if(setwidth * 1 >= winWidth * 1.2 || (setheight + extraheight) * 1 >= winHeight * 1) { //document.getElementById("floating_window").style.position = "absolute"; } else { document.getElementById("floating_window").style.position = "fixed"; } //document.getElementById("floating_window").style.marginLeft = -1 * (setwidth / 2) + "px"; //if(winHeight > setheight) document.getElementById("floating_window").style.marginTop = -1 * (winHeight / 2) + "px"; //document.getElementById("floating_window").style.marginTop = -1 * ((setheight * 1 + extraheight * 1) / 2) + "px"; if(set_parent=="body") { floating_window_parent = document.body; } else if(element_exists(set_parent)) { floating_window_parent = document.getElementById(set_parent); } else if(element_exists("main_area")) { floating_window_parent = document.getElementById("main_area"); } else { floating_window_parent = document.body; } set_info_location("init"); set_info_location("followup"); document.getElementById("floating_window_title").innerHTML = set_title; var fwc = ersDE("floating_window_content"); if (fwc) { fwc.style.minHeight = (setheight - 38) + "px"; fwc.innerHTML = unescape_decode(set_content); } //document.getElementById("main_inner_area").style.display = "block"; document.getElementById("floating_window").style.visibility = "visible"; obj_parent = get_parent_element("floating_window"); obj_parent_pos = getObjPosition(obj_parent); obj_pos = getElementPosition("floating_window"); width_diff = obj_parent_pos['width'] - obj_pos['width']; set_x = width_diff / 2; //document.getElementById("floating_window").style.left = set_x + "px"; if(framename) { set_info_location("followup"); iframe = document.getElementById(framename); if (iframe.attachEvent){ iframe.attachEvent("onload", function(){ sizeresult = frame_autosize(iframe); set_info_location("init"); }); } else { iframe.onload = function(){ sizeresult = frame_autosize(iframe); set_info_location("init"); }; } } else set_info_location("init"); //iwinpos = getElementPosition(floating_window_parent.id); /*if(opener) { opener_pos = getObjPosition(opener); set_y = (opener_pos['top'] - obj_parent_pos['top']) - obj_pos['height'] / 4; document.getElementById("floating_window").style.top = set_y + "px"; }*/ if (call_when_built && {}.toString.call(call_when_built) === '[object Function]') { call_when_built(); } } window.open_floating_window = open_floating_window; function frame_autosize(iframe) { iframe.width = null; iframe.height = null; newwidth=iframe.contentWindow.document.body.scrollWidth; newheight=iframe.contentWindow.document.body.scrollHeight; if(newheight > 400) newheight = 400; iframe.width = (newwidth * 1 + 60) + "px"; iframe.height = (newheight * 1 + 30) + "px"; return new Array(iframe.width,iframe.height); } window.frame_autosize = frame_autosize; function open_floating_frame(set_title,set_frame,set_parent,setwidth,setheight,setcolor,call_when_built) { if(/dev-test/.test(location.toString())) { http_root = "https://ourers.com/"; } else http_root = ""; if(!setcolor) setcolor = "#ddddee"; if(!setwidth) setwidth = 480; if(!setheight) setheight = 320; set_frame = set_frame.replace(/\?/ig,"&"); set_content = ""; open_floating_window(set_title,set_content,set_parent,setwidth,setheight,"floating_frame",setcolor,call_when_built); } window.open_floating_frame = open_floating_frame; function open_floating_iframe(set_title,set_frame,set_parent,setwidth,setheight,setcolor) { if(/dev-test/.test(location.toString())) { http_root = "https://ourers.com/"; } else http_root = ""; if(!setcolor) setcolor = "#ddddee"; if(!setwidth) setwidth = 480; if(!setheight) setheight = 320; set_frame = set_frame.replace(/\?/ig,"&"); set_content = ""; open_floating_window(set_title,set_content,set_parent,setwidth,setheight,"floating_frame",setcolor); } window.open_floating_iframe = open_floating_iframe; function open_floating_src(set_title,set_frame,set_parent,setwidth,setheight,setcolor) { if(!setcolor) setcolor = "#ddddee"; if(!setwidth) setwidth = 480; if(!setheight) setheight = 320; //set_frame = set_frame.replace(/\?/ig,"&"); // commented out because it interferes with get vars JML 2023-04-06 set_content = ""; open_floating_window(set_title,set_content,set_parent,setwidth,setheight,"floating_frame",setcolor); } window.open_floating_src = open_floating_src; function open_floating_ajax_link(set_title,set_container,set_ajax_link,set_parent,setwidth,setheight) { var set_content = "