var PSD = {
  // iOS Non Flash Device Scan
  isiPad : navigator.userAgent.match(/iPad/i) != null ? true : false,
  isiPod : navigator.userAgent.match(/iPod/i) != null ? true : false,
  isiPhone : navigator.userAgent.match(/iPhone/i) != null ? true : false,
  nonFlash : function() {
    return (PSD.isiPad || PSD.isiPhone || PSD.isiPod)
  },
  // iOS orientation settings
  initiOSOrientation: function(){
    if(PSD.nonFlash()){
      
      var iViewport = jQuery('meta[name="viewport"]');

      if (PSD.isiPad) {
        var initScale = "0.7";
        var minScale = "0.7";
        var maxScale = "0.95";
        var scalable = 'yes';
        if (orientation == 0 || orientation == 180) {
          // Portrait
          initScale = "0.7";
        } else if (orientation == 90 || orientation == -90) {
          // Landscape
          initScale = "0.95";
        }
      } else if (PSD.isiPhone) {
        var initScale = "0.2";
        var minScale = "0.2";
        var maxScale = "0.5";
        var scalable = 'yes';
        if (orientation == 0 || orientation == 180) {
          // Portrait
          initScale = "0.2";
        } else if (orientation == 90 || orientation == -90) {
          // Landscape
          initScale = "0.5";
        }
      }
      iViewport.attr('content', 'width=device-width, initial-scale='+initScale+', minimum-scale='+minScale+', maximum-scale='+maxScale+', user-scalable='+scalable+'');
    }
  }
}

PSD.initiOSOrientation();
