// http://gecko.hp2.jp/2010/05/17/【css】ipadだけにcssを適用する方法


$.extend({

  iPadLoadStyle: function(opt) {

    var opt = jQuery.extend( {

      common: false,

      landscape: false,

      portrait: false

    }, opt),

    iPad = /iPad/.test(navigator.userAgent),

    d = document,

    $head = $("head"),

    linktag = function(h,m){

      var tag = d.createElement("link");

      tag.href = h;

      tag.media = m;

      tag.type = "text/css";

      tag.rel = "stylesheet";

      return tag;

    };

    if(iPad){

      //common

      if(opt.common) $head.append(linktag(opt.common,"only screen and (max-device-width: 1024px)"));

      //landscape

      if(opt.landscape) $head.append(linktag(opt.landscape,"all and (orientation:landscape)"));

      //portrait

      if(opt.portrait) $head.append(linktag(opt.portrait,"all and (orientation:portrait)"));

    }
    return this;

  }

});

