// obj
var x_open_win_id = document.getElementById("x_open_win");
var x_open_content_id = document.getElementById("x_open_content");
var title_msg_layer_id = document.getElementById("title_msg_layer");
var x_open_frame_id = document.getElementById("x_open_frame");
var max_button_name_id = document.getElementById("max_button_name");
var border_img_name1_id = document.getElementById("border_img_name1");
var border_img_name2_id = document.getElementById("border_img_name2");
var x_open_win_border_id = document.getElementById("x_open_win_border"); 
var size_info_layer_id =  document.getElementById("size_info_layer"); 
var dragapproved = false;
var dragresized = false;
var minrestore = 0;
var initialwidth, initialheight;
var x_open_ie5 = document.all && document.getElementById;
var x_open_ns6 = document.getElementById && !document.all;
var title_height = 36;
 
function x_open(title, url, width, height){
 if (!x_open_ie5 && !x_open_ns6)
  window.open(url, "", "width=width,height=height,scrollbars=1");
 else{
  x_open_win_id.style.display = '';
  initialwidth = width;
  initialheight = height ;
  change_size(initialwidth, initialheight);
  x_open_win_id.style.left = "10px";
  x_open_win_id.style.top=x_open_ns6 ? window.pageYOffset * 1 + 10 + "px" : iecompattest().scrollTop * 1 + 10 + "px";
  x_open_frame_id.src = url;
  title_msg_layer_id.innerHTML = '<font color=#333333>' + title + '</font>';
 }
}
function iecompattest(){
 return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function xopen_about(){
 str = "算法之家(http://www.getcn.net)版权所有";
 alert(str);
}
function xopen_back()
function xopen_forward()
function xopen_reload()
function closeit(){
 x_open_frame_id.src = loading_page;
 x_open_win_id.style.display = "none";
 return true;
}
function maximize(){
 if (minrestore == 0){
  minrestore = 1; //maximize window
  max_button_name_id.setAttribute("src", restore_img);
  max_button_name_id.setAttribute("title", '还原窗口');
  w = x_open_ns6 ? window.innerWidth - 40 : iecompattest().clientWidth - 20;
  h = x_open_ns6 ? window.innerHeight - 40 : iecompattest().clientHeight - 20;
  change_size(w, h);
 }
 else{
  minrestore=0; //restore window
  max_button_name_id.setAttribute("src", max_img);
  max_button_name_id.setAttribute("title", '放大窗口');
  change_size(initialwidth, initialheight);
 }
 x_open_win_id.style.left = x_open_ns6 ? window.pageXOffset + 10 + "px" : iecompattest().scrollLeft + 10 + "px";
 x_open_win_id.style.top = x_open_ns6 ? window.pageYOffset + 10 + "px" : iecompattest().scrollTop + 10 + "px";
}
function change_size(w, h){ 
  if(w > 150 ) {
   x_open_win_id.style.width = w;
  }else{
   x_open_win_id.style.width = 150;
  }
  if(h > 0 ) {
   x_open_win_id.style.height = border_img_name1_id.style.height = border_img_name2_id.style.height = x_open_frame_id.style.height = h;
  }else{
   x_open_win_id.style.height = border_img_name1_id.style.height = border_img_name2_id.style.height = x_open_frame_id.style.height = 0;
   
  }
  size_info_layer_id.innerHTML = '<font style="font-size:11px;font-family:Courier New">size:' + remove_units(x_open_win_id.style.width) + 'x' + remove_units(x_open_win_id.style.height) + '</font>';
}
 
function remove_units(elem)
//<<<drag move
function initialize_drag(e){
 var evt = x_open_ns6 ? e : event;
 offsetx = evt.clientX;
 offsety = evt.clientY;
 tempx = parseInt(x_open_win_id.style.left);
 tempy = parseInt(x_open_win_id.style.top);
 dragapproved = true;
 //x_open_frame.style.display = 'none';
 x_open_frame_id.style.display = 'none';
 document.body.style.cursor = 'move';
 document.onmousemove = drag_drop;
 x_open_win_id.onmouseup = drag_drop_stop;
}
function drag_drop(e){
 if(dragapproved){
  var evt = x_open_ns6 ? e : event;
  x_open_win_id.style.left = tempx + evt.clientX - offsetx + "px";
  x_open_win_id.style.top = tempy + evt.clientY - offsety + "px";
 }
 return false;
}
function drag_drop_stop(e){
 dragapproved = false;
 //x_open_content_id.style.display = '';
 x_open_frame_id.style.display = '';
 document.body.style.cursor = 'default';
 document.onmousemove=null;
}
 
//>>>drag move
//resize===<<<
function initialize_resize(e){
 evt = x_open_ns6 ? e : event;
 x_open_win_border_id.style.left = x_open_win_id.style.left;
 x_open_win_border_id.style.top = x_open_win_id.style.top;
 x_open_win_border_id.style.width = x_open_win_id.style.width;
 x_open_win_border_id.style.height = x_open_win_id.style.height;
 click_x = evt.clientX;
 click_y = evt.clientY;
 evt_width = click_x - remove_units(x_open_win_id.style.left);
 evt_height = click_y - remove_units(x_open_win_id.style.top);
 dragresized = true;
 x_open_win_border_id.style.display = '';
 x_open_win_border_id.style.border='1px #808080 solid';
 
 document.body.style.cursor = 'nw-resize';
 document.onmousemove = drag_resize;
 document.onmouseup = drag_resize_stop;
 return false;
}
function drag_resize(e){
 if(dragresized){
  var evt = x_open_ns6 ? e : event;
  w = evt_width + (evt.clientX - click_x);
  h = evt_height + (evt.clientY - click_y);
  if(w > 0 ) {
   x_open_win_border_id.style.width = w;
  }
  if(h > 0 ) {
   x_open_win_border_id.style.height = h;
  }
 }
 document.body.style.cursor = 'nw-resize';
 return false;
}
function drag_resize_stop(e){
 dragresized=false;
 change_size(remove_units(x_open_win_border_id.style.width), remove_units(x_open_win_border_id.style.height));
 x_open_win_border_id.style.border='0px';
 x_open_win_border_id.style.display = 'none';
 document.body.style.cursor='default';
 document.onmousemove=null;
}
//resize===>>>
 
//-->
</script>
</head>
<body>
演示: <a href="javascript:x_open('google', 'http://www.google.com',600,400)">打开 google</a> 
- <a href="javascript:x_open('网站通建站专家网', 'http://www.jscode.cn',600,400)">打开网页特效观止</a> 
- <a href="javascript:x_open('网站通建站专家网', 'http://www.html.org.cn',500,350)">网页设计爱好者</a>
</body>
</html>
                        检测代码效果 请进