/* vim:set ts=2 sw=2 sts=2 ai si nu et ft=javascript ff=dos:

  Last Change: 13-July-2009 11:43:27.
  Author: Technical team.
  Copyright: (C)Anchor Group K.K.

  URL: http://www.anchor-gr.jp/labo.html
  EMAIL: info@anchor-gr.jp

  Filename: smartpopup.js

 ---------------------------------------------------------*/

var smartPopupVersion = "1.1.2";

function smartPopup(wnd_opt, cls_name, wnd_name, mode) { function e(url, wnd_opt, wnd_name) { var r = window.open(url, wnd_name, wnd_opt); if(r) r.focus(); return false; } if(!wnd_opt) wnd_opt = "" ; if(!cls_name) cls_name = "smartPopup" ; var anc = document.getElementsByTagName("a"); var len = anc.length; var reg = new RegExp((mode==1 ? "^((.+)?)$" : "^"+cls_name+"(:(.+))?")); var wreg = new RegExp("name=([^\,]+)"); for(var i=0; i<len; i++){ if((a = anc[i]) && (a.rel.match(reg))){ a["wnd_opt"] = (RegExp.$2 == "" ? wnd_opt : RegExp.$2); if(a["wnd_opt"].match(wreg)){ a["wnd_name"] = RegExp.$1; a["wnd_opt"] = a["wnd_opt"].replace(wreg, ""); }else{ a["wnd_name"] = (wnd_name ? wnd_name : wnd_name = "w" + Math.random()); } a.onclick = function() { return e(this.href, this.wnd_opt, this.wnd_name); } } } }
function smartPopupAll(wnd_opt) { smartPopup(wnd_opt, null, null, 1); }

