//---------------------------------
// linkタグ作成処理
// in ：cssのファイル名
// out：linkタグ
//---------------------------------
function createLinkTag(cssfile){

  // cssファイルが格納してあるディレクトリ
  // !!!!!!!!!!!!環境に合わせて設定してください!!!!!!!!!
  var directory = "http://www.nature-n.com/css/";

  // linkタグ作成
  var tag = "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + directory + cssfile + "\" />";

  return tag;
}


//---------------------------------
// OS・ブラウザ分類処理
// in：なし
// out：cssファイル名
//---------------------------------
function classify() {

  // *********************************************
  // 各組み合わせのCSSファイル名を設定してください
  // !!!!!!!!!!!!環境に合わせて設定してください!!!!!!!!!

      // Windows x IE
     cssfile11 = "w_ie.css";

     // Windows x NN
     cssfile12 = "w_nn.css";

     // Windows x その他
     cssfile13 = "w_other.css";


     // Mac x IE
     cssfile21 = "m_ie.css";

     // Mac x NN
     cssfile22 = "m_nn.css";

     // Mac x その他
     cssfile23 = "m_other.css";

  // *********************************************


  // 使用CSSファイル
  var cssfile = "";

  // OS
  var platform = navigator.platform;

  // ブラウザ
  var browser = navigator.appName;

  // ユーザエージェント
  var agent = navigator.userAgent;


  // OS:Windows
  if (platform.indexOf("Win") != -1) {


    // Internet Explorer 
    // (Operaが成りすましている可能性があるので"Opera"が入っていない場合とする)
    if ((agent.indexOf("MSIE") != -1) && (agent.indexOf("Opera") == -1)) {
      cssfile = cssfile11;
    }

    // Netscape Navigetor
    else if (agent.indexOf("Netscape") != -1) {
      cssfile = cssfile12;
    }

    // Netscape Navigetor 4以下
    else if ((agent.indexOf("Mozilla/4") != -1) && (browser.indexOf("Netscape") != -1)) {
      cssfile = cssfile12;
    }

    // その他
    else {

      cssfile = cssfile13;

/* とりあえず今はコメント
      // Opera
      if (agent.indexOf("Opera") != -1) {

      }

      // Mozilla
      else if (agent.indexOf("Gecko") != -1) {

      }
*/
    }

  }

  // OS:Mac他
  else {

    // Internet Explorer 
    // (Operaが成りすましている可能性があるので"Opera"が入っていない場合とする)
    if ((agent.indexOf("MSIE") != -1) && (agent.indexOf("Opera") == -1)) {
      cssfile = cssfile21;
    }

    // Netscape Navigetor
    else if (agent.indexOf("Netscape") != -1) {
      cssfile = cssfile22;
    }

    // Netscape Navigetor 4以下
    else if ((agent.indexOf("Mozilla/4") != -1) && (browser.indexOf("Netscape") != -1)) {
      cssfile = cssfile22;
    }

    // その他
    else {
      cssfile = cssfile23;

/* とりあえず今はコメント
      // Opera
      if (agent.indexOf("Opera") != -1) {

      }

      // Safari
      else if (agent.indexOf("Safari") != -1) {

      }
*/
    }

  }
  return cssfile;
}

//---------------------------------
// linkタグ出力処理
// in ：なし
// out：linkタグ
//---------------------------------
function dispTag() {

  // cssファイル名を取得
  var cssfile = classify();

  // linkタグを作成し、作成後の文字列を返す
  return createLinkTag(cssfile);

}

document.write(dispTag());
