/*
  lee.js: jQuery plugin for lee
  利用には jquery.js 必須。
*/
var lee = {
  //画像プリローダ
  preloader: {
    loadedImages: [],
    load: function(url){
      var img = this.loadedImages;
      var l = img.length;
      img[l] = new Image();
      img[l].src = url;
    }
	}
};

$(function(){
  
	//ロールオーバー
  $(".button").each(function(){
    this.originalSrc = $(this).attr("src");
    this.rolloverSrc = this.originalSrc.replace(/(\.gif|\.jpg|\.png)/,"_h$1");
    lee.preloader.load(this.rolloverSrc);
  }).hover(function(){
    $(this).attr("src",this.rolloverSrc);
  },function(){
    $(this).attr("src",this.originalSrc);
  });
  /*
    example.gif をロールオーバーさせる場合、
    (1) 通常時の画像 example.gif とロールオーバー時の画像 example_h.gif を用意
    (2) img または input[type="image"] 要素に button クラスを付与

    マークアップ例:
    <a href="****.html"><img src="example.gif" alt="****" class="button"></a>
    <input type="image" name="****" src="example.gif" alt="****" class="button" />
  */
  
  //別ウィンドウ
  $("a[href^='http']").not("a[href*='.lee.com/'], a[href*='.goo.ne.jp/'], a[href*='.verisign.com/']").addClass("external");
  $("a.external").click(function(){
    window.open(this.href);
    return false;
  });
  $("a[href='https://signup.lee.com/wkwksgnp/except/search_area/input_tel.html']").addClass("popup").click(function(){
    window.open(this.href);
    return false;
  });
  /*
    lee.com ドメイン以外へのリンクに external クラスが自動的に付与され、クリックで別ウィンドウが開く。
    lee.com ドメインへのリンクを別ウィンドウで開く場合は手動で external クラスを付与すること。

    マークアップ例:
    <a href="****.html" class="external">****</p>
  */

  //奇数・偶数
//  $("ul.index li:nth-child(odd)").addClass("odd");
//  $("ul.index li:nth-child(even)").addClass("even");
  /*
    奇数・偶数を設定したい ul 要素に index クラスを付与。

    マークアップ例:
    <ul class="index">
      <li>****</li>
      <li>****</li>
    </ul>
  */
  
  //透過 PNG
  //$("img[src$='.png']").pngfix();
  
});

