// @charset="utf-8";

/**
 * default.js - Optimized Senmeisha, inc.
 * @author	KIMURA, Tsuyoshi From Senmeisha, inc.
 * @version	6.8.3
 */


/**
 * OnLoad Event
 */

function init() {
  mailToSenmeisha();
}


function mailToSenmeisha() {
  if (navigator.userAgent.indexOf("Safari") != -1) {
    if (document.getElementById("e_address")){
      mailToSenmeishaElement();
    }
  }
  else if (navigator.userAgent.indexOf("Macintosh") != -1) {
    if (navigator.userAgent.indexOf("Firefox") != -1) {
      if (document.getElementById("e_address")){
        mailToSenmeishaElement();
      }
    }
  }
}


function mailToSenmeishaElement() {
  var address;
  var subject;
  if (document.URL.indexOf("employment") != -1) {
    address = "job@senmeisha.co.jp";
    subject = "採用についての問い合わせ";
  }
  else {
    address = "senmeisha@senmeisha.co.jp";
    subject = "（株）千明社への問い合わせ";
  }
  document.getElementById("e_address").setAttribute("href", "mailto:" + address + "?subject=" + subject);
}



function thisPageIsNotAvailable() {
  var page;

  // 現在のURIをpageに代入
  page = document.URL

  // URIからドメインを除去
  page = domainRemoval(page);

  // 対応するページアドレスの取得
  page = newPageName(page);

  // 新URI生成
  page = newUri(page);

  // 書き出し
  document.getElementById("newTitle").innerHTML = "このページの新URL";
  document.getElementById("newUri").innerHTML = page;
}

// URIからドメインを除去
function domainRemoval(uri) {
  var n;
  var value;

  // ダブルスラッシュまでを除去
  n = uri.indexOf("//");
  n += 2;
  value = uri.substring(n, uri.length);

  // ドメインを除去
  n = value.indexOf("/");
  value = value.substring(n, value.length);

  return value;
}

// 対応するページアドレスの取得
function newPageName(oldPage) {
  var on = new Array();
  on[0] = new Array("/main/home/index.html", "/");
  on[1] = new Array("/main/home/", "/");
  on[2] = new Array("/main/services/index.html", "/services/");
  on[3] = new Array("/main/services/actual.html", "/services/actual.html");
  on[4] = new Array("/main/services/ddcp.html", "/services/ddcp.html");
  on[5] = new Array("/main/services/process.html", "/services/process.html");
  on[6] = new Array("/main/services/success.html", "/services/success.html");
  on[7] = new Array("/main/services/", "/services/");
  on[8] = new Array("/main/company/index.html", "/company/");
  on[9] = new Array("/main/company/bases.html", "/company/bases.html");
  on[10] = new Array("/main/company/history.html", "/company/history.html");
  on[11] = new Array("/main/company/", "/company/");
  on[12] = new Array("/main/employment/index.html", "/employment/");
  on[13] = new Array("/main/employment/career.html", "/employment/career.html");
  on[14] = new Array("/main/employment/event_2007.html", "/employment/event.html");
  on[15] = new Array("/main/employment/freshman_2007.html", "/employment/freshman.html");
  on[16] = new Array("/main/employment/", "/employment/");
  on[17] = new Array("/main/about/", "/about.html");
  on[18] = new Array("/main/brain/", "/brain.html");
  on[19] = new Array("/main/information/", "/");
  on[20] = new Array("/main/iso/", "/iso.html");
  on[21] = new Array("/main/privacy/", "/privacy.html");
  on[22] = new Array("/main/sitemap/", "/sitemap.html");

  var newPage = "/";

  for (var i=0; i<on.length; i++) {
    if (oldPage.indexOf(on[i][0]) != -1) {
      newPage = on[i][1];
      break;
    }
  }

  return newPage;
}

// 新URI生成
function newUri(pageName) {
  var uri;
  uri = "http://www.senmeisha.co.jp" + pageName;
  uri = '<a href="' + uri + '">' + uri + '</a>';
  return uri;
}



/**
 * Write HTML For FLASH
 * @author	KIMURA, Tsuyoshi From Senmeisha, inc.
 * @version	6.6.27
 * @see http://allabout.co.jp/internet/javascript/closeup/CU20031224/index.htm
 */

function swfWriter(uri, id, quality, loop, width, height, bgcolor) {

  var code = ""

  code += '<object';
  code += ' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';
  code += ' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"';
  code += ' id="' + id + '"';
  code += ' width="' + width + '"';
  code += ' height="' + height + '"';
  code += '>';

  code += '<param name="allowScriptAccess" value="sameDomain" />';
  code += '<param name="movie" value="' + uri + '" />';
  code += '<param name="quality" value="' + quality + '" />';
  code += '<param name="loop" value="' + loop + '" />';
  code += '<param name="bgcolor" value="' + bgcolor + '" />';

  code += '<embed';
  code += ' pluginspage="http://www.macromedia.com/go/getflashplayer"';
  code += ' type="application/x-shockwave-flash"';
  code += ' allowScriptAccess="sameDomain"';
  code += ' src="' + uri + '"';
  code += ' quality="' + quality + '"';
  code += ' loop="' + loop + '"';
  code += ' width="' + width + '"';
  code += ' height="' + height + '"';
  code += '></embed>';

	code += '</object>';

  document.write(code);

}

