function magform() {

  document.getElementById('mailtxt').onfocus = function(){
    if (this.value == 'メールアドレス') this.value = '';
  }
  document.getElementById('mailtxt').onblur = function(){
    if (this.value == '') this.value = 'メールアドレス';
  }
  //入力項目に不備があった場合にジャンプ・フォーカスする。
  if(document.getElementById("magform").err.value != ""){
    location.href = ("#mag");
    document.getElementById("magform").mag_mail.focus();
  }

  var h = screen.height;

  /* ウィンドウオブジェクトを格納する変数名 */
  var win2;

  /* オプション値の配列 */
  var opt_ary = new Array(9);
  /* 表示（1）、非表示（0）*/
  opt_ary["directories"]=0;
  opt_ary["location"]=0;
  opt_ary["menubar"]=0;
  opt_ary["resizable"]=1;
  opt_ary["scrollbars"]=1;
  opt_ary["status"]=0;
  opt_ary["toolbar"]=0;
  /* 0を指定した場合は省略 */
  opt_ary["top"]=0;
  opt_ary["left"]=0;
  opt_ary["width"]=585;

  var browser = navigator.userAgent;

  //ブラウザ振り分け
  if(window.opera){
    opt_ary["height"]= h - 249;
  }else if(browser.match(/(MSIE 6)/)){
    opt_ary["height"]= h - 277;
  }else if(browser.match(/(MSIE 7)/)){
    opt_ary["height"]= h - 284;
  }else if(browser.match(/(MSIE 8)/)){
    opt_ary["height"]= h - 252;
  }else if(browser.match(/(Chrome)/)){
    opt_ary["height"]= h - 258;
  }else if(browser.match(/(Safari)/)){
    opt_ary["height"]= h - 234;
  }else{
    opt_ary["height"]= h - 285;
  }

if (!document.getElementsByTagName) return false;
var links = document.getElementsByTagName("a");
  for (var i=0; i < links.length; i++) {
	if (links[i].className.match("mag_pu")) {
	  links[i].onclick = function() {

        var opt="";
        opt+=(opt_ary["directories"]==1)?"directories=1,":"";
        opt+=(opt_ary["location"]==1)?"location=1,":"";
        opt+=(opt_ary["menubar"]==1)?"menubar=1,":"";
        opt+=(opt_ary["resizable"]==1)?"resizable=1,":"";
        opt+=(opt_ary["scrollbars"]==1)?"scrollbars=1,":"";
        opt+=(opt_ary["status"]==1)?"status=1,":"";
        opt+=(opt_ary["toolbar"]==1)?"toolbar=1,":"";
        opt+=(opt_ary["top"]>0)?"top="+opt_ary["top"]+",":"";
        opt+=(opt_ary["left"]>0)?"left="+opt_ary["left"]+",":"";
        opt+=(opt_ary["width"]>0)?"width="+opt_ary["width"]+",":"";
        opt+=(opt_ary["height"]>0)?"height="+opt_ary["height"]+",":"";

        if(!win2 || win2.closed){
          win2 = window.open(this.href,'new2',opt);
		  return false;
        }else{
          /*  既にウィンドウが開いている場合はフォーカスを当てる */
          win2.focus();
		  return false;
        }
	  }
	}
  }
}
